GithubHelp home page GithubHelp logo

Comments (12)

savsgio avatar savsgio commented on July 19, 2024 1

Here you have the feature: https://godoc.org/github.com/savsgio/atreugo#Atreugo.TimeoutPath 😄

Thanks for your contribution.

from atreugo.

savsgio avatar savsgio commented on July 19, 2024 1

I saw that erik merged your PR, when release a new version of fasthttp i will add it in atreugo. ;)

from atreugo.

savsgio avatar savsgio commented on July 19, 2024

Hi @losingle,

Do you need ctx.TimeoutErrorWithCode(...) or TimeoutHandler??

from atreugo.

savsgio avatar savsgio commented on July 19, 2024

You could call to ctx.TimeoutErrorWithCode() directly, as you would do in native fasthttp, in atreugo handler.

However, TimeoutHandler is not implemented yet. I will add it soon.

from atreugo.

losingle avatar losingle commented on July 19, 2024

You could call to ctx.TimeoutErrorWithCode() directly, as you would do in native fasthttp, in atreugo handler.

However, TimeoutHandler is not implemented yet. I will add it soon.

Very much looking forward to this feature.
I can only use first eliminating CTX references in goroutines now

from atreugo.

losingle avatar losingle commented on July 19, 2024

Here you have the feature: https://godoc.org/github.com/savsgio/atreugo#Atreugo.TimeoutPath 😄

Thanks for your contribution.

How do I change the status code ?
eg. valyala/fasthttp@38473d3

from atreugo.

savsgio avatar savsgio commented on July 19, 2024

TimeoutPath always return 408 if timeout is reached like fasthttp in https://godoc.org/github.com/valyala/fasthttp#TimeoutHandler

If you want to set a custom status code in response, use https://godoc.org/github.com/savsgio/atreugo#RequestCtx or ctx.SetStatusCode(<yourStatusCode>)

from atreugo.

savsgio avatar savsgio commented on July 19, 2024

I think you are supervising the timeout manually, right? with channels, selects, context or something similar.

if it's truth, not use PathTimeout or ctx.TimeoutErrorWithCode(...), just finish the handler and return the response with your own status code

from atreugo.

losingle avatar losingle commented on July 19, 2024

well, as if only timeout manually
thank you

from atreugo.

savsgio avatar savsgio commented on July 19, 2024

So, why do you need to change the status code when timeout?

I see your PR valyala/fasthttp#589 in fasthttp.

I think so, it's not recommended to return another status code if timeout

from atreugo.

losingle avatar losingle commented on July 19, 2024

Yes, normally, there is no need to change the status code, following the rules of HTTP.
However, some business scenarios may be needed, and I think fasthttp, as a network base library, should give control to the developers.
Because our business will need to timeout the request, return 204 status code

from atreugo.

savsgio avatar savsgio commented on July 19, 2024

I've just release a new version v8.1.0 with TimeoutWithCodePath support :)

from atreugo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.