Closed mstar-kk closed 4 years ago
Merging #76 into master will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #76 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 91 102 +11
=========================================
+ Hits 91 102 +11
Impacted Files | Coverage Δ | |
---|---|---|
lib/form.js | 100.00% <100.00%> (ø) |
|
lib/json.js | 100.00% <100.00%> (ø) |
|
lib/text.js | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update a847bfd...ff4a6b2. Read the comment docs.
we should separate the transform function for three types
I don't think add this options is required. If you have something that is not compatible with the standard, you should use https://github.com/stream-utils/raw-body to handle it by yourself.
Another solution is use text
type and parse by yourself later.
I think that as long as node provides services to the outside, this problem can not be avoided, because there is no guarantee of what language the client is java,python or whatever. And just like parse form body can use different querystring module in a user-defined, this paramater do the same job for other body type. Axios has interceptors with similar capabilities. From this point of view, this function is required. Thanks for review my code.
@dead-horse
Whatever language the client use, they should follow the spec (like https://www.json.org/json-en.html, https://url.spec.whatwg.org/#urlencoded-serializing), and co-body only support the standard version of JSON / X-www-form-urlencoded format.
Certainly the phenomenon you describe exists, but there are so few scenarios that I don't want to have to provide new features for the sake of such scenarios, which is not conducive to keeping the code cohesive and streamlined.
ok,I understand.And thanks again. @dead-horse
Add a parameter named transformBody to parse the request body in a user-defined way. For example,