Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Use parse and asserts from http.servlet #3534

Merged

Conversation

krombel
Copy link
Contributor

@krombel krombel commented Jul 13, 2018

http.server contains methods to parse requests and throw SynapseErrors when there is something wrong.
That can be a missing required param or a string which cannot be parsed to int.

This methods should be used in order to deduplicate checks.

On top of that the method assert_params_in_request got renamed to assert_params_in_dict as it does not handle request objects but dicts

krombel added 2 commits July 13, 2018 21:40
parse_integer and parse_string can take a request and raise errors
in case we have wrong or missing params.
This PR tries to use them more to deduplicate some code and make it
better readable
the method "assert_params_in_request" does handle dicts and not
requests. A request body has to be parsed to json before this method
can be used
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

1 similar comment
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@hawkowl
Copy link
Contributor

hawkowl commented Jul 13, 2018

matrixbot: test this please

@hawkowl hawkowl merged commit 8532953 into matrix-org:develop Jul 13, 2018
@krombel krombel deleted the use_parse_and_asserts_from_servlet branch July 13, 2018 23:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants