Skip to content

Commit

Permalink
Remove broken support for GET requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydenseric committed Jul 14, 2020
1 parent 3130c0d commit d115ea1
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ const {
serializeFetchParameter,
createSignalIfSupported,
parseAndCheckHttpResponse,
fromError,
rewriteURIForGET,
} = require('@apollo/client');
const {
extractFiles,
isExtractableFile,
ReactNativeFile,
} = require('extract-files');

/**
* A React Native [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File)
* substitute.
Expand Down Expand Up @@ -181,7 +180,6 @@ exports.createUploadLink = ({
credentials,
headers,
includeExtensions,
useGETForQueries,
} = {}) => {
const linkConfig = {
http: { includeExtensions },
Expand Down Expand Up @@ -251,24 +249,7 @@ exports.createUploadLink = ({
});

options.body = form;
} else {
// If requested, set method to GET if there are no mutations.
if (
useGETForQueries &&
!operation.query.definitions.some(
(definition) =>
definition.kind === 'OperationDefinition' &&
definition.operation === 'mutation'
)
)
options.method = 'GET';

if (options.method === 'GET') {
const { newURI, parseError } = rewriteURIForGET(uri, body);
if (parseError) return fromError(parseError);
uri = newURI;
} else options.body = payload;
}
} else options.body = payload;

return new Observable((observer) => {
// If no abort controller signal was provided in fetch options, and the
Expand Down

0 comments on commit d115ea1

Please sign in to comment.