Skip to main content

All Questions

Tagged with
1 vote
0 answers
1k views

Golang - Gin BindJSON to []byte

Question: I'm using GORM and the Gin Web Framework to create a RESTful API. I'm trying to bind the body of a JSON request with BindJSON to the model, but the model contains a slice of byte leading to ...
yogopo's user avatar
  • 11
0 votes
1 answer
3k views

GoLang Gin - Binding JSON data from POST request rewrites all Identifier Fields to 0

I am taking my first steps with GoLang, and currently setting up an API Server, which is able to read JSON file from POST Request and save that to Memory. I have a JSON File as Following: [ { ...
haapjari's user avatar
0 votes
2 answers
2k views

getting error message along with result in go api

I have one route in API where I can get users with roles. In this route, if I put the name of the user then I will get all the roles assigned to him/her. But the problem is that it returns only the ...
 rocco's user avatar
  • 153
0 votes
1 answer
60 views

dsnap.Data() returns nil if the document does not exist

I have written a controller GetUser to get a particular user from Database(Firestore) on the basis of id I put in the query. If the user is not present in the database then it should give the message ...
 rocco's user avatar
  • 153
2 votes
1 answer
2k views

Getting "multipart: NextPart: EOF" error when reading multipart/form-data

I am building a router layer for an API where I take the response and extract a parameter (in this case a service_code, the name can vary - service_code, serviceCode, code need to handle all) from the ...
Archit Verma's user avatar
  • 1,907
1 vote
1 answer
575 views

multiple response in single array in golang

I am new to golang . and I want to get my response as multiple result. I do some method but I need to change that one impartErrl := ph.profileService.ValidateSchema(gojsonschema.NewStringLoader(string(...
Mia Mia's user avatar
  • 153
-1 votes
1 answer
147 views

Unable to access json data from request in request handler after calling BindJSON in middleware

I have created a basic CRUD API using Go-Gin. Calling BindJSON in request handler gives me a blank object after calling BindJSON in middleware but works fine if I remove BindJSON in middleware. This ...
Sanjay's user avatar
  • 1
0 votes
0 answers
880 views

Postman can't handle JSON response with long string

I was building an API with GO that retrieves some data from a MongoDB database and responds with a JSON So everything works fine until I put in the "Content" line, and the problem seems to be limited ...
zireael9797's user avatar
1 vote
2 answers
3k views

Why got 404 for API endpoint with react-admin?

Created backend API use gin with go language type Post struct { ID uint `json:"id"` Title string `json:"title"` Body string `json:"body"` } func main() { // ... r := gin.Default()...
v v's user avatar
  • 653
15 votes
1 answer
18k views

How to write a stream API using gin-gonic server in golang? Tried c.Stream didnt work

I wanted to create one streaming API using gin-gonic server in golang. func StreamData(c *gin.Context) { chanStream := make(chan int, 10) go func() {for i := 0; i < 5; i++ { ...
kunalag's user avatar
  • 151