Category "go-gin"

Programmatically set an url parameter in gin context for testing purpose

I am writing some test suites for gin middlewares. I found a solution to test them without having to run a full router engine, by creating a gin context like th

Change Content-Type header in Gin middleware

I have a custom gin middleware set up to handle errors but however, it does change to the Content-Type header. package middleware import ( "fmt" "net/

Golang gin gonic web framework proxy route to another backend

How to reverse proxy web requests for a few routes to another backend in Gin Gonic web golang framework Is there a way to directly forward in the Handle functi

Returning JSON data as a stream per chunk to Angular2 or jQuery over HTTP2 (HTTPS)

In one of my API's I mostly return a result (let's say paged 50 results) as one whole in an json array like so: [{},{},{},{},{},...] I was wondering if there

Gorm and Gin error 500 only when Updating

I've a pretty simple CRUD for a Task list, and so far I'm able to Create, List all, List by ID and Delete records, bu when I try to update, it gives me the foll

Testing gin based REST API not getting params while using net/http/httptest

I am developing a REST API based on Gin Go, the endpoint looks something like below: func carsByType(c *gin.Context) { fmt.Println("Go Request in Handler...

How to correctly set Mock Row and Query for go-sqlmock

I'm setting up testing in golang. I use go-sqlmock to test mysql connection. But sqlmock.NewRows and mock.ExpectQuery does not work well with error. I want to k