Skip to content

Commit

Permalink
feat(content type): add octet-stream content type
Browse files Browse the repository at this point in the history
  • Loading branch information
AhalyaPai committed Dec 10, 2024
1 parent 59ae9e4 commit 45ce713
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,23 @@ export interface ErrorState {
error: Error;
}

type ContentType = 'image' | 'json' | 'xml' | 'text';
type ContentType = 'image' | 'json' | 'xml' | 'text' | 'octet-stream';
type BodyFormat = 'preview' | 'raw';

const bodyFormatMap: Record<ContentType, BodyFormat[]> = {
image: ['preview'],
json: ['preview', 'raw'],
xml: ['preview', 'raw'],
text: ['raw'],
'octet-stream': ['preview', 'raw'],
};

const regex: Record<ContentType, RegExp> = {
image: /image\/(.?)*(jpeg|gif|png|svg)/,
json: /application\/(.?)*json/,
xml: /(text|application)\/(.?)*(xml|html)/,
text: /text\/.*/,
'octet-stream': /application\/(.?)*octet-stream/,
};

export function getResponseType(contentType: string) {
Expand Down

0 comments on commit 45ce713

Please sign in to comment.