[BUG] Adding custom gotInstance results in error
See original GitHub issueGreat package! Really hoping to use on my latest project, but I’m running into an error trying to use a custom got instance:
Describe the bug Adding a custom gotInstance to the options results in the following error:
Error when executing query: The `body`, `json` and `form` options are mutually exclusive
To Reproduce Code sandbox reproducing issue: https://codesandbox.io/s/fervent-lake-lfeoe?file=/src/index.js Relevant code:
const gotInstance = got.extend({
timeout: 1000
});
const query = {
variables: {
code: {
type: "ID!",
value: code
}
},
operation: {
name: "country",
args: {
code: "$code"
},
fields: ["name", "capital"]
}
};
const options = {
gotInstance
};
const response = await gotQL.query(
"https://countries.trevorblades.com",
query,
options
);
Current behavior Adding a got instance results in error
Expected behavior Got instance should be used without error
Additional context Code sandbox reproducing issue: https://codesandbox.io/s/fervent-lake-lfeoe?file=/src/index.js
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Custom errors thrown in afterResponse are suppressed #1352
Describe the bug If my afterResponse hook throws a custom error, I'm not expecting it to be rewritten into a Got Request Error...
Read more >Custom errors, extending Error - The Modern JavaScript Tutorial
When we develop something, we often need our own error classes to reflect specific things that may go wrong in our tasks.
Read more >Best Practices for Node.js Error-handling - Toptal
Developers working with Node.js sometimes find themselves writing not-so-clean code while handling all sorts of errors. This article will introduce you to ...
Read more >A Comprehensive Guide To Error Handling In Node.js
Custom error classes that extend the Error object will retain the basic error properties, such as message , name , and stack ,...
Read more >What's a good way to extend Error in JavaScript?
Test cases I used can be found here: JavaScript self-made Error object ... (If you want to add custom methods to your subclass,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Updated to 2.0.1 and verified that it is working without error. Thank you for fixing this so quickly!
I ran some tests and managed to simulate the problem locally. The failure is occurring due to the version of the package got. In version 9 the request works normally, but if we upgrade to version 11, it returns the error reported by @pilar1347 . @khaosdoctor if you want, I can open a pull request with the minimum changes so that gotql works in version 11 (got), but we will have some changes in the runner.ts file, modifications in the typescript types and test correction