Possible inconsistent method: parse
See original GitHub issueI’ve run into some trouble while trying to customize the way response bodies are parsed – specifically on the client.
From these tests, it appears that the parse
method of the node library is used to customize how response bodies are parsed.
This test shows that the parse
method of the client library is used to customize how request bodies are serialized.
Is this inconsistency intentional? If not and a maintainer would like to specify the intended behavior, I’d be happy to open a PR.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Inconsistent parsing using find method in Beautiful Soup
I am attempting to parse a website with the find() method, but it doesn't find all of the elements I attempting to parse....
Read more >parse method signature is inconsistent with react-docgen · Issue ...
I noticed this while doing a clause like below: const reactDocgen = require('react-docgen') const tsDocgen = require('@bebraw/react-docgen-typescript').
Read more >ACT seems to be inconsistent with its parsing; any ... - Reddit
My ACT seems to parse people very low sometimes, when I feel like they're actually doing better/give me their own parse numbers. Any...
Read more >Parsing error [bug?] with systems of nonlinear PDEs ...
NDSolveValue::femper: PDE parsing error of Div[{{1,0},{0,v}}.Grad$9730]. Inconsistent equation dimensions. It seems like extremely basic ...
Read more >[Rd] Inconsistent Parse Behavior
Under some specific conditions, `parse` seems to produce inconsistent and potentially incorrect results the first time it is run in a fresh clean...
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
The term
serialize
is used in Superagent’s codebase, so for 2.0 I suggest:parse(fn)
for parsing response body only (this is a breaking change)serialize(fn)
for generating data to send in the requestSadly, it looks like
request.parse
indeed sets a request body serializer and thenthis._parse
in the browser request instance is indeed a function used for serializing request bodies. Thus I don’t think the confusion is request vs. response but rather parse vs. serialize. I’d like to see a PR for the following changes:this._parser
to something more clear likethis._serializeBody
in the browser client codereq.serializeBody()
(open to more concise suggestions for the name). This can be an alias of the currentreq.parse
in the client code.exports.serialize
which presumably can be overridden in a straightforward way if a user has read the source, but maybe we should make an explicit API to keep parity with the browser code.request.parse
with corresponding doc updates