Giter Club home page Giter Club logo

Comments (9)

joshfriend avatar joshfriend commented on September 23, 2024 14

@madhavan020985 you need to set ERROR_404_HELP to False in your app config.

from flask-restful.

NiklasRosenstein avatar NiklasRosenstein commented on September 23, 2024 3

Wouldnt it make more sense to be able to configure this per Api or per Resource? Maybe I want this feature on one API but not on another.

from flask-restful.

kevinburke avatar kevinburke commented on September 23, 2024

yeah that's not good, will look into a fix.

from flask-restful.

frankstratton avatar frankstratton commented on September 23, 2024

it's also weird when I send any kwarg and 'message' shows up along with it, which is unexpected.

abort(404, error="user {} not found".format(args['with_id']))
{
"message": "You have requested this URI [/foo/z4s6hp33im0h] but did you mean /foo/<key> ?"
"error": "user 123 not found."
}

If you want to provide sane defaults, that's one thing. But don't add parameters when I've explicitly said I don't want a field called 'message' in my output.

from flask-restful.

kevinburke avatar kevinburke commented on September 23, 2024

Partially fixed in #71

from flask-restful.

kevinburke avatar kevinburke commented on September 23, 2024

The problem is that message is included by default, see 7fbac1b.

It would require more work to allow leaving out the 'message' property.

https://github.com/twilio/flask-restful/blob/master/flask_restful/utils/__init__.py#L20

from flask-restful.

kevinburke avatar kevinburke commented on September 23, 2024

This has been fixed.

from flask-restful.

 avatar commented on September 23, 2024

Is this fix available in flask - 0.10.1, flask-restful - 0.3.2... when i had an abort,404 with custom message, it made two mistakes... it replaced the custom message with 404 default message and it added a lot more messages like,
abort(404, {'message': 'custom error message to appear in body'})
gives,

{"status": 404, "message": "Not Found. You have requested this URI [/api/orca/v1.0/1234/reboot] but did you mean /api/orca/v1.0/string:SerialNumber/string:Action or /api/orca/v1.0/checkout or /api/orca/v1.0/checkin ?"}

from flask-restful.

zogzog avatar zogzog commented on September 23, 2024

@madhavan020985 you need to set ERROR_404_HELP to False in your app config.

This does not work with a blueprint.

from flask-restful.

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.