Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit b05ea87

Browse files
Fix PR comments
1 parent bcea5f4 commit b05ea87

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ export const HTTP_HEADERS = {
5858
ACCEPT: "Accept",
5959
AUTHORIZATION: "Authorization",
6060
CONNECTION: "Connection",
61-
CONTENT_TYPE: "Content-Type"
61+
CONTENT_TYPE: "Content-Type",
62+
LOCATION: "Location"
6263
};
6364

6465
export const HTTP_STATUS_CODES = {
6566
SUCCESS: 200,
67+
FOUND: 302,
6668
UNAUTHORIZED: 401,
6769
PAYMENT_REQUIRED: 402
6870
};

lib/services/authentication-service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ServerRequest, ServerResponse, Server } from "http";
22
import { parse } from "url";
33
import { isInteractive } from "../helpers";
4+
import { HTTP_HEADERS, HTTP_STATUS_CODES } from "../constants";
45

56
export class AuthenticationService implements IAuthenticationService {
67
private static DEFAULT_NONINTERACTIVE_LOGIN_TIMEOUT_MS: number = 15 * 60 * 1000;
@@ -36,8 +37,8 @@ export class AuthenticationService implements IAuthenticationService {
3637
const parsedUrl = parse(request.url, true);
3738
const loginResponse = parsedUrl.query.response;
3839
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);
4142
this.killLocalhostServer();
4243

4344
isResolved = true;

0 commit comments

Comments
 (0)