@based/server
Advanced tools
Comparing version 6.7.3 to 6.8.0
@@ -18,3 +18,3 @@ "use strict"; | ||
} | ||
else if (typeof authState[key] !== 'string') { | ||
else if (key !== 'persistent' && typeof authState[key] !== 'string') { | ||
return { error: `${key} is not of string` }; | ||
@@ -21,0 +21,0 @@ } |
@@ -13,5 +13,5 @@ import { BasedServer } from '../server'; | ||
path: string; | ||
type: "function" | "channel" | "query" | "stream"; | ||
type: "function" | "channel" | "query" | "stream" | "app"; | ||
}; | ||
}; | ||
export declare function createError<T extends BasedErrorCode>(server: BasedServer, context: Context, code: T, payload: ErrorPayload[T]): BasedErrorData<T>; |
@@ -22,2 +22,3 @@ "use strict"; | ||
else { | ||
// @ts-ignore | ||
const { fn } = spec; | ||
@@ -24,0 +25,0 @@ return (0, hash_1.hash)(fn.toString()); |
@@ -29,2 +29,19 @@ "use strict"; | ||
}; | ||
const getQuery = (req) => { | ||
const obj = {}, string = req.getQuery(); | ||
let index = 0; | ||
let index2; | ||
let index3; | ||
do { | ||
index2 = string.indexOf('=', index); | ||
if (index2 == -1) | ||
index2 = string.length; | ||
index3 = string.indexOf('&', index2 + 1); | ||
if (index3 == -1) | ||
index3 = string.length; | ||
obj[string.slice(index, index2)] = string.slice(index2 + 1, index3); | ||
index = index3 + 1; | ||
} while (index3 != string.length); | ||
return obj; | ||
}; | ||
const httpHandler = (server, req, res) => { | ||
@@ -64,3 +81,9 @@ res.onAborted(() => { | ||
if (route.public !== true) { | ||
const authorization = req.getHeader('authorization'); | ||
let authorization = req.getHeader('authorization'); | ||
if (!authorization && req.getQuery()) { | ||
const query = getQuery(req); | ||
if (query.authorization) { | ||
authorization = query.authorization; | ||
} | ||
} | ||
if (authorization.length > 5e3) { | ||
@@ -67,0 +90,0 @@ (0, sendError_1.sendError)(server, { |
{ | ||
"name": "@based/server", | ||
"version": "6.7.3", | ||
"version": "6.8.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
395899
5984