@libj/http-meta
Advanced tools
Comparing version 0.0.21 to 0.1.0
export declare const makeHttpBearerAuth: (token: string) => string; | ||
export declare const parseHttpBearerAuthToken: (auth: string) => string; | ||
interface ParseOptions { | ||
silent?: boolean; | ||
} | ||
export declare const parseHttpBearerAuthToken: (auth: string, options?: ParseOptions) => string | null; | ||
export {}; |
@@ -5,2 +5,3 @@ "use strict"; | ||
var HttpAuthScheme_1 = require("./HttpAuthScheme"); | ||
var error_1 = require("../../error"); | ||
exports.makeHttpBearerAuth = function (token) { | ||
@@ -12,9 +13,13 @@ if (!token || !token.trim()) { | ||
}; | ||
exports.parseHttpBearerAuthToken = function (auth) { | ||
var parts = auth.split(HttpAuthScheme_1.HttpAuthScheme.BEARER); | ||
if (parts.length === 2) { | ||
exports.parseHttpBearerAuthToken = function (auth, options) { | ||
if (options === void 0) { options = {}; } | ||
var parts = auth && auth.split(HttpAuthScheme_1.HttpAuthScheme.BEARER); | ||
if (parts && parts.length === 2 && parts[1].trim()) { | ||
return parts[1].trim(); | ||
} | ||
throw new Error("Unable to parse bearer token from auth: " + auth); | ||
if (options.silent) { | ||
return null; | ||
} | ||
throw new error_1.UnauthorizedHttpError(); | ||
}; | ||
//# sourceMappingURL=httpBearerAuth.js.map |
{ | ||
"dependencies": {}, | ||
"name": "@libj/http-meta", | ||
"version": "0.0.21", | ||
"version": "0.1.0", | ||
"description": "Http meta kit", | ||
@@ -24,3 +24,3 @@ "author": "Sergey Poskachey <seregynp@gmail.com>", | ||
], | ||
"gitHead": "ca1018b4258d991964b8f2594dafda492454864f" | ||
"gitHead": "569269235fb823d2d35933add6c86e1ee9eca888" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40646
579