Skip to content

Enable using api.parser(trim=True)#644

Open
EtiennePelletier wants to merge 2 commits intopython-restx:masterfrom
EtiennePelletier:namespace_parser_kwargs
Open

Enable using api.parser(trim=True)#644
EtiennePelletier wants to merge 2 commits intopython-restx:masterfrom
EtiennePelletier:namespace_parser_kwargs

Conversation

@EtiennePelletier
Copy link
Contributor

@EtiennePelletier EtiennePelletier commented Jan 22, 2026

The Namespace.parser shortcut is quite useful, but does not allow using different RequestParser kwargs than the default values currently. In some cases, I think doing api.parser(trim=True)  would be cleaner than separately importing RequestParser to access this functionality.

I am suggesting a mini change to enable just that, which is fully backwards-compatible.

🐍 🤹‍♂️

Copy link

@themavik themavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single test: Namespace.parser passes kwargs.

Copy link

@themavik themavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curl redirect probe

Copy link

@themavik themavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Namespace.parser(**kwargs) delegating to RequestParser(**kwargs) matches Api.parser; test_api_shortcut_kwargs covers trim=True. nit: assert parser.trim is True reads cleaner than == True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants