Giter Club home page Giter Club logo

Comments (4)

rushmorem avatar rushmorem commented on May 14, 2024

Just noticed the documentation for SetResult says it will automatically unmarshal "if response status code is greater than 399". I guess you meant "less than" instead of "greater than". However, why this restriction?

from resty.

jeevatkm avatar jeevatkm commented on May 14, 2024

Thanks, will continue to make it better along with community.

I would say it is handled based on scenario Success and Failure/Error. I will describe how it is currently structured then share your thoughts. Good catch on documentation end, I have the corrected it.

  • If status code is between 200 and 299 considered as success, you can retrieve via response.Result()
  • If status code is greater than 399 considered as failure/error, you can retrieve via response.Error()

More info, please have a look at parseResponseBody middleware.

from resty.

jeevatkm avatar jeevatkm commented on May 14, 2024

Let's say, you have unified Error structure for all request. In that case, Resty has option of setting Error at client level, instead of every request.

resty.SetError(&Error{})           // or  resty.SetError(Error{})  

from resty.

rushmorem avatar rushmorem commented on May 14, 2024

Makes sense. Thanks for clarifying.

from resty.

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.