-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
Description
When I using echo to build my own web server, I find that when the client request with none standard http Content-Type
, echo will just return 415 media type unsupported,
For the packet captured as below, the Content-Type
is text/xml
.
POST /wx?signature=0af0cbc713df074c3fefa4a9916c9b7fdf28194c×tamp=1488192434&nonce=1149750594&openid=oQwuZwwzZW7uoOvKM70E8A3Z4xKM HTTP/1.1
User-Agent: Mozilla/4.0
Accept: */*
Host: hiweeds.net
Pragma: no-cache
Content-Length: 280
Content-Type: text/xml
<xml><ToUserName><![CDATA[gh_caef70508bdb]]></ToUserName>
<FromUserName><![CDATA[oQwuZwwzZW7uoOvKM70E8A3Z4xKM]]></FromUserName>
<CreateTime>1488192434</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[unsubscribe]]></Event>
<EventKey><![CDATA[]]></EventKey>
</xml>HTTP/1.1 415 Unsupported Media Type
Content-Type: application/json; charset=UTF-8
Date: Mon, 27 Feb 2017 10:47:14 GMT
Content-Length: 36
{"message":"Unsupported Media Type"}
Checklist
- [ * ] Dependencies installed
- [ * ] No typos
- [ * ] Searched existing issues and docs
Expected behaviour
We want to support processing such request.
Actual behaviour
Echo just block it before I processing it.
Steps to reproduce
just use curl command to request echo based web server. with content-type as text/xml
Working code to debug
Normal Echo based web server.
package main
func main() {
}
Version/commit
Latest