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

feat: token header 修改

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