-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error to deal with content-type which has multiple part like 'application/x-www-form-urlencoded; text/html; charset=utf-8' #22
Comments
Seems like it's the duty of koa. that.request.is() hasn't return the form type. |
@daiwhea Hi, very thanks! Actually.. When I think, you can give custom error types to I'll mark it as Cheers, 🍺 |
Hm. Actually, try var opts = {
extendTypes: {
form: ['x-www-form-urlencoded', 'text/html']
}
} I guess it should work, currently. |
Thank you. I have tried but it doesn't work. var opts = { Now I use an ugly use() in the top of app.js. But it's not that cute! app.use(function* (next) { |
Hm, interesting. I'll review |
@daiwhea, would you try these var opts = {
extendTypes: {
form: ['x-www-form-urlencoded', 'html']
}
}
// and
var opts = {
extendTypes: {
form: ['application/x-www-form-urlencoded', 'text/html']
}
} I'm curious why it not work. And cant test it at the moment. ref: koa.request docs I guess, cuz they both should be written in one style. |
I am also curious why is this header |
Other than that... yea I should rush the process of incoming release, because a lot of things was changed from last updates. |
Thank you! Both won't work. This header comes from the greatest alipay notify. Alipay is an online payment api used in China. In order to test, I used an use() to force the request.header['content-type'] = 'application/x-www-form-urlencoded; text/html; charset=utf-8'; of course it's only for locally testing. app.use(function* log_raw_request(next) { |
Mm, okey, thanks. Also, you can use |
Thanks. Will this.set() just set the koa.response headers? I need to set the request.header. |
O yea yea.
this.set sets the response, my mistake. |
Thank you sir. I have visited jshttp/type-is#16 , and they have closed that issue. Yes, it's the duty of alipay api. But we cannot change it. I also viewed your koa-better-body/index.js ["version": "1.0.17"] on line 105. There are 3 judgements. When alipay header comes, there is no judgement will be entered. Can we append the raw body in the last else branch?
|
I think this is resolved in refactor branch. More at #34. |
I use koa-better-body to parse the form data for a long time. It goes well. But when I got a form which has 'content-type' header like 'application/x-www-form-urlencoded; text/html; charset=utf-8', id won't parse the form at all.
Thanks!
The text was updated successfully, but these errors were encountered: