@apollo/datasource-rest
Advanced tools
Comparing version 6.1.0 to 6.1.1
@@ -99,4 +99,4 @@ /// <reference types="node" /> | ||
protected errorFromResponse({ response, parsedBody, }: { | ||
url: URL; | ||
request: RequestOptions; | ||
url?: URL; | ||
request?: RequestOptions; | ||
response: FetcherResponse; | ||
@@ -103,0 +103,0 @@ parsedBody: unknown; |
@@ -94,9 +94,10 @@ "use strict"; | ||
async errorFromResponse({ response, parsedBody, }) { | ||
const codeByStatus = new Map([ | ||
[401, 'UNAUTHENTICATED'], | ||
[403, 'FORBIDDEN'], | ||
]); | ||
const code = codeByStatus.get(response.status); | ||
return new graphql_1.GraphQLError(`${response.status}: ${response.statusText}`, { | ||
extensions: { | ||
...(response.status === 401 | ||
? { code: 'UNAUTHENTICATED' } | ||
: response.status === 403 | ||
? { code: 'FORBIDDEN' } | ||
: {}), | ||
...(code && { code }), | ||
response: { | ||
@@ -103,0 +104,0 @@ url: response.url, |
{ | ||
"name": "@apollo/datasource-rest", | ||
"description": "REST DataSource for Apollo Server v4", | ||
"version": "6.1.0", | ||
"version": "6.1.1", | ||
"author": "Apollo <packages@apollographql.com>", | ||
@@ -26,3 +26,2 @@ "license": "MIT", | ||
"prettier-fix": "prettier --write .", | ||
"publish-changeset": "changeset publish", | ||
"spell-check": "cspell lint '**' '.changeset/**' --no-progress || (echo 'Add any real words to cspell-dict.txt.'; exit 1)", | ||
@@ -32,24 +31,26 @@ "test": "jest", | ||
"watch": "tsc --build --watch", | ||
"lint": "eslint src/**/*.ts" | ||
"lint": "eslint src/**/*.ts", | ||
"changeset-publish": "changeset publish", | ||
"changeset-check": "changeset status --verbose --since=origin/main" | ||
}, | ||
"devDependencies": { | ||
"@apollo/server": "4.9.1", | ||
"@apollo/server": "4.9.3", | ||
"@changesets/changelog-github": "0.4.8", | ||
"@changesets/cli": "2.26.2", | ||
"@types/jest": "29.5.3", | ||
"@types/jest": "29.5.4", | ||
"@types/lodash.isplainobject": "4.0.7", | ||
"@types/node": "16.18.41", | ||
"@typescript-eslint/eslint-plugin": "6.4.0", | ||
"@typescript-eslint/parser": "6.4.0", | ||
"cspell": "7.0.0", | ||
"eslint": "8.47.0", | ||
"@types/node": "16.18.50", | ||
"@typescript-eslint/eslint-plugin": "6.6.0", | ||
"@typescript-eslint/parser": "6.6.0", | ||
"cspell": "7.3.5", | ||
"eslint": "8.49.0", | ||
"form-data": "4.0.0", | ||
"graphql": "16.8.0", | ||
"jest": "29.6.2", | ||
"jest": "29.6.4", | ||
"jest-junit": "16.0.0", | ||
"nock": "13.3.3", | ||
"prettier": "3.0.2", | ||
"prettier": "3.0.3", | ||
"ts-jest": "29.1.1", | ||
"ts-node": "10.9.1", | ||
"typescript": "5.1.6" | ||
"typescript": "5.2.2" | ||
}, | ||
@@ -71,4 +72,4 @@ "dependencies": { | ||
"node": "18.17.1", | ||
"npm": "9.8.1" | ||
"npm": "10.1.0" | ||
} | ||
} |
@@ -359,14 +359,16 @@ import type { | ||
}: { | ||
url: URL; | ||
request: RequestOptions; | ||
url?: URL; | ||
request?: RequestOptions; | ||
response: FetcherResponse; | ||
parsedBody: unknown; | ||
}) { | ||
const codeByStatus = new Map<number, string>([ | ||
[401, 'UNAUTHENTICATED'], | ||
[403, 'FORBIDDEN'], | ||
]); | ||
const code = codeByStatus.get(response.status); | ||
return new GraphQLError(`${response.status}: ${response.statusText}`, { | ||
extensions: { | ||
...(response.status === 401 | ||
? { code: 'UNAUTHENTICATED' } | ||
: response.status === 403 | ||
? { code: 'FORBIDDEN' } | ||
: {}), | ||
...(code && { code }), | ||
response: { | ||
@@ -373,0 +375,0 @@ url: response.url, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107519
1585