Skip to content

Commit

Permalink
Feat: content-type 支持大写
Browse files Browse the repository at this point in the history
  • Loading branch information
pandaoh committed Sep 22, 2023
1 parent f766324 commit 204dfad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Request/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: HxB
* @Date: 2022-04-26 14:15:37
* @LastEditors: DoubleAm
* @LastEditTime: 2023-08-24 12:25:12
* @LastEditTime: 2023-09-22 09:49:44
* @Description: 请求相关函数
* @FilePath: \js-xxx\src\Request\index.ts
*/
Expand Down Expand Up @@ -246,10 +246,11 @@ export function xFetch(
* getContentType('form'); /// 'application/x-www-form-urlencoded'
* getContentType('file'); /// 'multipart/form-data'
* getContentType('pdf'); /// 'application/pdf'
* getContentType('PDF'); /// 'application/pdf'
* getContentType('unknown'); /// 'application/octet-stream'
* @param fileType 文件类型
* @returns
*/
export function getContentType(fileType: string): string {
return CONTENT_TYPES[fileType] ?? 'application/octet-stream';
return CONTENT_TYPES[fileType.toLowerCase()] ?? 'application/octet-stream';
}

0 comments on commit 204dfad

Please sign in to comment.