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

core/endpoint: Get choices from PUT if POST missing #592

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BenoitKnecht
Copy link

Fixes: #591

If the API token is not allowed to POST on a particular endpoint, choices won't be returned in .actions.POST, but we can still get them in .actions.PUT.

This commit falls back to getting choices from .actions.PUT instead of raising an exception when .actions.POST is missing.

@arthanson
Copy link
Collaborator

@BenoitKnecht Can you please add a test case for this?

If the API token is not allowed to POST on a particular endpoint, choices won't
be returned in `.actions.POST`, but we can still get them in `.actions.PUT`.

This commit falls back to getting choices from `.actions.PUT` instead of
raising an exception when `.actions.POST` is missing.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
Make sure we can get choices from the `PUT` action when the API doesn't
allow `POST`, and that the `POST` data takes precedence over the `PUT`
data.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
@BenoitKnecht BenoitKnecht force-pushed the get-choices-from-post-or-put branch from dddd5fa to 0f9a463 Compare September 30, 2024 12:18
@BenoitKnecht
Copy link
Author

@arthanson Sorry for the massive delay, I somehow missed your message.

I've added a couple of unit tests, let me know if that's good enough.

@BenoitKnecht
Copy link
Author

@arthanson Could you take another look at this PR? I'd really love to get this merged.

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.

Choices are not returned when the API token can PUT but not POST on an endpoint
2 participants