Skip to content

Commit

Permalink
Expose the acceptableMediaTypes function
Browse files Browse the repository at this point in the history
  • Loading branch information
jdesrosiers committed Jan 10, 2024
1 parent 46488aa commit 2906365
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ removeMediaTypePlugin("application/reference+json");
[Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept)
header of requests to indicate to servers what media types are preferred
over others.
* acceptableMediaTypes(): string;
Build an `Accept` request header from the registered media type plugins.
This function is used internally. You would only need it if you're writing a
custom `http(s):` URI scheme plugin.
## URI Schemes
Expand Down
1 change: 1 addition & 0 deletions lib/index.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export {
addMediaTypePlugin,
removeMediaTypePlugin,
setMediaTypeQuality,
acceptableMediaTypes,
UnsupportedMediaTypeError,
UnknownMediaTypeError
} from "./media-types/media-types.js";
Expand Down
1 change: 1 addition & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export type MediaTypePlugin<T extends Document = Document> = {
export const addMediaTypePlugin: (contentType: string, plugin: MediaTypePlugin) => void;
export const removeMediaTypePlugin: (contentType: string) => void;
export const setMediaTypeQuality: (contentType: string, quality: number) => void;
export const acceptableMediaTypes: () => string;

export class UnsupportedMediaTypeError extends Error {
public constructor(mediaType: string, message?: string);
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export {
addMediaTypePlugin,
removeMediaTypePlugin,
setMediaTypeQuality,
acceptableMediaTypes,
UnsupportedMediaTypeError,
UnknownMediaTypeError
} from "./media-types/media-types.js";
Expand Down

0 comments on commit 2906365

Please sign in to comment.