Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix non-unique-parameter check for post request #228

Merged
merged 2 commits into from
Aug 18, 2021
Merged

Conversation

tyrasd
Copy link
Member

@tyrasd tyrasd commented Aug 17, 2021

Description

Fixes a bug where no error is returned for non-unique request parameters in POST requests (see #12).

To reproduce the issue using javascript in a browser (note the duplicate filter parameter in both request below):

console.log((await fetch("https://api.ohsome.org/v1/elements/count?bboxes=8.67%2C49.39%2C8.71%2C49.42&filter=type%3Anode&filter=type%3Away&format=json&time=2014-01-01%2F2017-01-01%2FP1Y", { "method": "GET" })).status);
// GET request -> returns 400

console.log((await fetch("https://api.ohsome.org/v1/elements/count", {
    "headers": {
        "content-type": "application/x-www-form-urlencoded"
    },
    "method": "POST",
    "body": "bboxes=8.67%2C49.39%2C8.71%2C49.42&filter=type%3Anode&filter=type%3Away&format=json&time=2014-01-01%2F2017-01-01%2FP1Y"
})).status);
// POST request -> returns 200

This PR also simplifies the implementation for GET requests as well and add tests.

Corresponding issue

See #12

Checklist

@tyrasd tyrasd added the bug Something isn't working label Aug 17, 2021
@tyrasd tyrasd force-pushed the fix-nonunique-check branch 2 times, most recently from 7eceef9 to 509e466 Compare August 18, 2021 08:30
@tyrasd tyrasd added the waiting for review This pull request needs a code review label Aug 18, 2021
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@joker234 joker234 removed the waiting for review This pull request needs a code review label Aug 18, 2021
and simplify the implementation for get requests as well
and add tests
@tyrasd tyrasd merged commit f763ac7 into master Aug 18, 2021
@tyrasd tyrasd deleted the fix-nonunique-check branch August 18, 2021 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants