提交 a2f3f59d 作者: 方治民 提交者: 方治民

feat: token header 修改

上级 747cbdc4
...@@ -68,7 +68,7 @@ export class Response { ...@@ -68,7 +68,7 @@ export class Response {
export class Request { export class Request {
method: string method: string
body: any body: any
headers?: { authorization?: string } headers?: { ['app-token']?: string }
query: any query: any
/** /**
...@@ -77,6 +77,6 @@ export class Request { ...@@ -77,6 +77,6 @@ export class Request {
* @returns token * @returns token
*/ */
static getRequestToken({ headers }: Request): string | undefined { static getRequestToken({ headers }: Request): string | undefined {
return headers?.authorization return headers?.['app-token']
} }
} }
...@@ -157,7 +157,7 @@ const transform: AxiosTransform = { ...@@ -157,7 +157,7 @@ const transform: AxiosTransform = {
const token = getToken() const token = getToken()
if (token && (config as Recordable)?.requestOptions?.withToken !== false) { if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
// jwt token // jwt token
;(config as Recordable).headers.Authorization = options.authenticationScheme ;(config as Recordable).headers['App-Token'] = options.authenticationScheme
? `${options.authenticationScheme} ${token}` ? `${options.authenticationScheme} ${token}`
: token : token
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论