-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Remove MimeType and change it to string
- Loading branch information
Showing
4 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import type { MimeType } from '../serializers'; | ||
|
||
export const getContentType = (headers: Headers): MimeType | void => { | ||
export const getContentType = (headers: Headers): string | void => { | ||
const contentType = headers.get('Content-Type'); | ||
if (typeof contentType !== 'string') { | ||
return; | ||
} | ||
|
||
return contentType.replace(/\s*;.*$/, '') as MimeType; | ||
return contentType.replace(/\s*;.*$/, ''); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
export type MimeType = 'application/json' | 'multipart/form-data'; | ||
|
||
export interface Serializer { | ||
serialize(type: MimeType, data: unknown): unknown; | ||
serialize(type: string, data: unknown): unknown; | ||
serializeQueryString(data: unknown): string; | ||
deserialize<T = Record<string, unknown>>(type: MimeType, data: unknown): T; | ||
deserialize<T = Record<string, unknown>>(type: string, data: unknown): T; | ||
} |