Skip to content

Commit a9f64a0

Browse files
authored
fix(deps): switch to using the "content-type" package for content type parsing (#807)
1 parent 4abc280 commit a9f64a0

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@octokit/endpoint": "^11.0.3",
2929
"@octokit/request-error": "^7.0.2",
3030
"@octokit/types": "^16.0.0",
31+
"content-type": "^2.0.0",
3132
"fast-content-type-parse": "^3.0.0",
3233
"json-with-bigint": "^3.5.3",
3334
"universal-user-agent": "^7.0.2"

src/fetch-wrapper.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { safeParse } from "fast-content-type-parse";
1+
import { parse, type ContentType } from "content-type";
22
import { JSONParse, JSONStringify } from "json-with-bigint";
33
import { isPlainObject } from "./is-plain-object.js";
44
import { RequestError } from "@octokit/request-error";
55
import type { EndpointInterface, OctokitResponse } from "@octokit/types";
66

7-
type ContentType = ReturnType<typeof safeParse>;
8-
97
/* v8 ignore next -- @preserve */
108
const noop = () => "";
119

@@ -162,7 +160,7 @@ async function getResponseData(response: Response): Promise<any> {
162160
return response.text().catch(noop);
163161
}
164162

165-
const mimetype = safeParse(contentType);
163+
const mimetype = parse(contentType);
166164

167165
if (isJSONResponse(mimetype)) {
168166
let text = "";

0 commit comments

Comments
 (0)