Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 07:35
    Kamandlou commented #3307
  • 02:46
    Coverage (#3202) -0.25%
  • 02:46
    mygityf closed #3202
  • 02:41
    RiansyahTohamba commented #715
  • 02:40
    RiansyahTohamba commented #715
  • 02:40
    RiansyahTohamba commented #715
  • 02:40
    RiansyahTohamba commented #715
  • Sep 27 19:47
    MartinHotmann commented #3339
  • Sep 27 19:46
    MartinHotmann commented #3339
  • Sep 27 13:56
    tiredsosha commented #3339
  • Sep 27 10:53
    FactoryManagerFeng edited #3343
  • Sep 27 10:49
    FactoryManagerFeng opened #3343
  • Sep 27 06:52
    fzf404 commented #1171
  • Sep 26 23:55
    whybangbang edited #3342
  • Sep 26 23:54
    whybangbang edited #3342
  • Sep 26 23:54
    whybangbang opened #3342
  • Sep 26 22:22
    MartinHotmann commented #3339
  • Sep 26 22:22
    MartinHotmann commented #3339
  • Sep 26 22:14
    codecov[bot] commented #3340
  • Sep 26 22:14
    Coverage (#3340) +0.00%
Danny Hermes
@dhermes
Is there any way to get code review on gin-gonic/gin#3054 ?
Dikdik Tasdik Laksana
@dikdiktasdik
hi
Abdul Saqib
@asaqib27
Could anyone please help me to get this point?
What is the use of this package: ginS
SolindekDev
@SolindekDev
How can I get body of post request in JSON?
Richard
@qloog
@SolindekDev use c.BindJSON func to bind to request struct
Kamis bin Bintang
@kamisdev93:matrix.org
[m]
Hello! Excellent Developers! I've just experienced with Gin-Gonic framework. I'm now looking for projects for hands-on practice. Please contact me and give me projects if you have any.
WERCK Ayrton
@Athosone
Hi !
I am looking to use gin to build our next restful API, however our company enforce media type versioning and I did not find a way to route request based on header content without changing the URL
Do you if that's something possible?
matt
@imattdu
this is good
eliphosif
@eliphosif
Hi all, I have a function (gin is used) that is talking to the database in the code, and based on the response the logic is written, how to write a unit tests using the testing package without changing the original function?
code in the playground: https://go.dev/play/p/1LpWRtDBatF
how do I create a mock context with all the headers, body, URL, and other details which I am sending from the client, I am stuck here, and also the function is not returning anything so, how do I mock the DB and make it work, how do I write a test which covers 80% code, can you pls suggest
seraph
@seraph98
hi, guys. What will happend if the groutine happened oom. Will the main progress will keep running, and the defer function will be executed in the oom's grotine?
Thomas Güttler
@guettli
Oom kills the process with signal 9. The process can't catch the signal. The whole process gets killed.
Muktar Iberahim
@muktar11
hello i just installed gin to my go app and it give me this ../../go/pkg/mod/github.com/gin-contrib/sse@v0.1.0/sse-decoder.go:1:1: expected 'package', found 'EOF'
../../go/pkg/mod/github.com/go-playground/universal-translator@v0.18.0/benchmarks_test.go:1:1: expected 'package', found 'EOF'
../../go/pkg/mod/github.com/ugorji/go/codec@v1.2.7/0_importpath.go:1:1: expected 'package', found 'EOF'
../../go/pkg/mod/google.golang.org/protobuf@v1.28.0/proto/bench_test.go:1:1: expected 'package', found 'EOF'
../../go/pkg/mod/gopkg.in/yaml.v2@v2.4.0/apic.go:1:1: expected 'package', found 'EOF'
witcher_
@witcher_:matrix.org
[m]
Hi. I'm having trouble serving files through gin. After the first few times(?) of downloading a file through the REST API defined, gin returns a 200 without a body. The code this happens in can be found here: https://github.com/LearningBay24/LearningBay24-backend/blob/7dd8de4d378ff2249b4d72fc81916891cefbf05b/api/api.go#L641=
The file exists on disk with at least read permissions and is not empty or corrupted. NGINX is handling requests on the server, but it is reproducable locally without NGINX.
Is this a known issue? If yes, how do I go about fixing it?
Thanks in advance!
snowlyg
@snowlyg
@witcher_:matrix.org You should add some Headers to the http response ctx.Header("Content-Type", "application/octet-stream") ctx.Header("Content-Disposition", "attachment; filename=your file name") ctx.Header("Content-Disposition", "inline;filename=your file name") ctx.Header("Content-Transfer-Encoding", "binary") ctx.Header("Cache-Control", "no-cache") ctx.File(your file path)
witcher_
@witcher_:matrix.org
[m]
Thanks for the answer! In the end it was the caching setting. As a quick fix, the frontend to that project will request files with the "Cache-Control" header set to "no-cache" as setting it on the response in the backend doesn't seem to fix this.
nyancow
@nyancow

Hi! I'd like to use mutliple auth middlewares, so that at least one must pass for a gin.RouterGroup
Currently I use:

// adapter "github.com/gwatts/gin-adapter"
// ...
private.Use(adapter.Wrap(jwtMiddleware.CheckJWT))

and I'd like to add one more JWT verifier, but for a different issuer.
Maybe someone can point me in the right direction? :)

shawshawwan
@ZoeShaw101
Hi ! I only want to serve http2 request with certain HandlerFunc ,not the whole http server. How to set gin http server to support this ?
shawshawwan
@ZoeShaw101
@snowlyg do you have any ideas?
mrredo
@mrredo
i have registered this route auth.GET("/logout", Logout) its just /auth/logout when im on new chrome user i use it once it works and in console it says it made a request but when i go there second time it displays nothing in console and redirects to / heres my logout function
func Logout(c *gin.Context) {
    session := sessions.Default(c)
    session.Clear()
    err := session.Save()
    if err != nil {
        panic(err)
    }
    c.Redirect(301, "/")
}
Asbjørn Ulsberg
@asbjornu
Is it possible that the multitemplate.Renderer doesn't support router.SetFuncMap()? With multitemplate.Renderer registered as the router.HTMLRender, I only get an error trying to access the functions registered with SetFuncMap().
Asbjørn Ulsberg
@asbjornu
By gin-contrib/multitemplate#2 it looks like this is unsupported?
Asbjørn Ulsberg
@asbjornu
Now I wonder whether it's possible to create a URL from the router. gin-gonic/gin#3256
Wutklumpen
@Wutklumpen
Good morning! Is gin susceptible to the recent ParseThru exploit, or is it unrelated at all? here's the article: https://thehackernews.com/2022/08/new-parsethru-parameter-smuggling.html
xz
@ChangshaTiger
image.png
I have this piece of code
but Flush does not work
the client still got all 3 events as a single chunk
image.png
Richard
@moos3-dev:matrix.org
[m]
So how can I redirect stdout to a websocket for realtime updating of a process running to a web page? ie I have a endpoint that kicks off a process that returns all the output to the gin server console but I want to stream it to a redirected page that connects to a websocket so the user can see the progress
kevin olson
@acidjazz
Hi everyone - is this gitter the main spot to for the gin community? is there a slack or a discord?
David Martorana
@themartorana
If I do a BeamToNamed and in the construction of that, stack 4-5 BeamPages, if I do a pop, it removes all the pages... where I'd want a back/pop action to only remove the top-most page
is there a way to do that?
Tiger Wang (王豫)
@tigerinus
Hello - I'd like to route any path starting with /ui to a specific handler, such as /ui/a.ext, /ui/a/a.ext, /ui/a/b/c/... or any arbitrary path. Is this supported? Thanks.
It looke like .GET("/ui") only matches the exact path /ui
kevin olson
@acidjazz
is it at all possible to render a template in gin similar to c.HTML but get the resulted html in a string instead of outputting it ?
Tymscar ⚙️
@Tymscar_twitter
Hi there! I am quite new to backend development and I am working on a project using Gin, and I am handling the auth with auth0. To be honest, I am a bit confused when it comes to how gin manages sessions
Basically they use "github.com/gin-contrib/sessions/cookie", but when I check on my chrome browser I dont see any session id or anything saved as a cookie
the only way I am logged in, is that I have a cookie set on the auth0 website
Now that would make me think this is a serverside cookie, but the issue with that is, theres no way for my backend to know who I am without reading the cookies from my auth0 login on their website
Harry Porter-Mills
@Haegin
Hi, I'm using Gin to build a backend API, and I'm trying to serve a JS SPA frontend using embedded files and the s.Engine.StaticFS functionality. This is working great for the index page, but when the SPA navigates to a route that should be controlled by the SPA Gin is returning a 404. Is there any way to tell it to serve the same index.html for everything under the route that's not in the filesystem?
ehsan
@ehsandavari