This repository was archived by the owner on Dec 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -58,11 +58,13 @@ export const HTTP_HEADERS = {
58
58
ACCEPT : "Accept" ,
59
59
AUTHORIZATION : "Authorization" ,
60
60
CONNECTION : "Connection" ,
61
- CONTENT_TYPE : "Content-Type"
61
+ CONTENT_TYPE : "Content-Type" ,
62
+ LOCATION : "Location"
62
63
} ;
63
64
64
65
export const HTTP_STATUS_CODES = {
65
66
SUCCESS : 200 ,
67
+ FOUND : 302 ,
66
68
UNAUTHORIZED : 401 ,
67
69
PAYMENT_REQUIRED : 402
68
70
} ;
Original file line number Diff line number Diff line change 1
1
import { ServerRequest , ServerResponse , Server } from "http" ;
2
2
import { parse } from "url" ;
3
3
import { isInteractive } from "../helpers" ;
4
+ import { HTTP_HEADERS , HTTP_STATUS_CODES } from "../constants" ;
4
5
5
6
export class AuthenticationService implements IAuthenticationService {
6
7
private static DEFAULT_NONINTERACTIVE_LOGIN_TIMEOUT_MS : number = 15 * 60 * 1000 ;
@@ -36,8 +37,8 @@ export class AuthenticationService implements IAuthenticationService {
36
37
const parsedUrl = parse ( request . url , true ) ;
37
38
const loginResponse = parsedUrl . query . response ;
38
39
if ( loginResponse ) {
39
- response . statusCode = 302 ;
40
- response . setHeader ( "Location" , parsedUrl . query . loginCompleteUrl ) ;
40
+ response . statusCode = HTTP_STATUS_CODES . FOUND ;
41
+ response . setHeader ( HTTP_HEADERS . LOCATION , parsedUrl . query . loginCompleteUrl ) ;
41
42
this . killLocalhostServer ( ) ;
42
43
43
44
isResolved = true ;
You can’t perform that action at this time.
0 commit comments