Compatible with Content-type: text/json when the request is in json format (#1710)

v1.0.x
onlyzilla 3 years ago committed by GitHub
parent 9116815183
commit 4d2522f0b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      pkg/net/http/blademaster/binding/binding.go

@ -10,6 +10,7 @@ import (
// MIME // MIME
const ( const (
MIMEJSON = "application/json" MIMEJSON = "application/json"
MIMEJSON2 = "text/json"
MIMEHTML = "text/html" MIMEHTML = "text/html"
MIMEXML = "application/xml" MIMEXML = "application/xml"
MIMEXML2 = "text/xml" MIMEXML2 = "text/xml"
@ -63,7 +64,7 @@ func Default(method, contentType string) Binding {
contentType = stripContentTypeParam(contentType) contentType = stripContentTypeParam(contentType)
switch contentType { switch contentType {
case MIMEJSON: case MIMEJSON, MIMEJSON2:
return JSON return JSON
case MIMEXML, MIMEXML2: case MIMEXML, MIMEXML2:
return XML return XML

Loading…
Cancel
Save