Allow content-type header to specify the charset

This commit is contained in:
Tomaž Jerman
2022-01-18 21:50:19 +01:00
committed by Denis Arh
parent 2c873d269f
commit 4b113af9cc
32 changed files with 88 additions and 88 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ func (r {{ export $.Endpoint.Entrypoint $a.Name }}) Get{{ export $p.Name }}() {{
// Fill processes request and fills internal variables
func (r *{{ export $.Endpoint.Entrypoint $a.Name }}) Fill(req *http.Request) (err error) {
{{ if $a.Params.Post }}
if strings.ToLower(req.Header.Get("content-type")) == "application/json" {
if strings.HasPrefix(strings.ToLower(req.Header.Get("content-type")), "application/json") {
err = json.NewDecoder(req.Body).Decode(r)
switch {