Comments (9)
@madhavan020985 you need to set ERROR_404_HELP
to False
in your app config.
from flask-restful.
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.
yeah that's not good, will look into a fix.
from flask-restful.
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.
Partially fixed in #71
from flask-restful.
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.
This has been fixed.
from flask-restful.
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.
@madhavan020985 you need to set
ERROR_404_HELP
toFalse
in your app config.
This does not work with a blueprint.
from flask-restful.
Related Issues (20)
- Return custom error code HOT 1
- Swagger doc like FastAPI HOT 2
- Did not attempt to load JSON data because the request Content-Type was not 'application/json'. HOT 8
- Is expected behavior of flask_restful abort() correct ? HOT 1
- Question: optional/wildcard url parameter HOT 1
- Flask 2.3 Incompatibility: app.propagate_exceptions is depreciated HOT 1
- test_client.get() with query_string doesn't work HOT 1
- The app.propagate_exceptions will be deprecated in Flask 2.3
- Using reqparse.add_argument() with default location parameter to parse requests with Content-Type other than "application/json" raises an exception when using Werkzeug>=2.1.0 HOT 3
- @api.resource is used in blueprint that it is not working HOT 1
- test_redirect failure HOT 1
- sdist is missing `tox.ini`
- This is alive? HOT 1
- response header "Server' cannot modified
- Is flask-restful dead? HOT 2
- Questions about Copilot + Open Source Software Hierarchy
- Documentation out of date for compatible Python versions
- Flask-RESTful breaks with Flask 2.3 and newer HOT 1
- Frontlight debug issues
- cannot import name 'cached_property' from 'werkzeug' (/Users/lingrui/anaconda3/envs/ads-server/lib/python3.11/site-packages/werkzeug/__init__.py)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-restful.