Gin: Bind JSON and Query?

Created on 18 Feb 2017  路  2Comments  路  Source: gin-gonic/gin

Hey, I'm trying to bind both json data AND query params in the same request.. when I use c.Bind and c.BindJSON together, gin tries to return a 400.

c.Bind(&example)
c.BindJson(&example)

Is there a way to avoid that 400 message?

[GIN-debug] [WARNING] Headers were already written. Wanted to override status code 400 with 200

Most helpful comment

I'm not sure I understand how this is a duplicate?

742 is an issue with the difference between c.Bind and c.BindJson... in this case I understand the difference, but I want to bind both json data AND query params in the same request. When I use both of these functions together, gin tries to print out a http 400 response code that I have to override.

It doesn't seem like I should have to override in order to do this.

All 2 comments

I'm not sure I understand how this is a duplicate?

742 is an issue with the difference between c.Bind and c.BindJson... in this case I understand the difference, but I want to bind both json data AND query params in the same request. When I use both of these functions together, gin tries to print out a http 400 response code that I have to override.

It doesn't seem like I should have to override in order to do this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wangcn picture wangcn  路  3Comments

kekemuyu picture kekemuyu  路  3Comments

gplume picture gplume  路  3Comments

mastrolinux picture mastrolinux  路  3Comments

boneq picture boneq  路  3Comments