Skip to content

testserver: log error on "method not allowed" same as "not found"#2933

Merged
denik merged 1 commit intomainfrom
denik/acc-method-not-allowed
May 23, 2025
Merged

testserver: log error on "method not allowed" same as "not found"#2933
denik merged 1 commit intomainfrom
denik/acc-method-not-allowed

Conversation

@denik
Copy link
Copy Markdown
Contributor

@denik denik commented May 23, 2025

This extends the diagnostics we have for 404 to 405 errors.

Today, if you call testserver and there is no path registered, you'll get 404 and a nice error message suggesting which setting to add to config. If you call some path that is present but does not have handler for the required method, you'll get 405 silently and without errors.

The deploy-artifact-path-type test had to be fixed since it relied on undefined handler before and now it fails.

This is both informational and also prevents shipping tests that do
not provide required handlers.
Response.Body = '{}'
# I'm adding 405 because that's what this test originally do. It's somewhat
# surprising though that CLI can receive 405 and that does not result in error anywhere.
Response.StatusCode = 405
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this for testing only?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, this change is required to make this test pass. Otherwise that call is made and since there is no handler, you now get t.Error().

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Got it -- so this still needs to be debugged in a follow-up.

@shreyas-goenka Could you figure out why this works when the backend returns a 405?

@denik denik requested a review from pietern May 23, 2025 08:08
Response.Body = '{}'
# I'm adding 405 because that's what this test originally do. It's somewhat
# surprising though that CLI can receive 405 and that does not result in error anywhere.
Response.StatusCode = 405
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Got it -- so this still needs to be debugged in a follow-up.

@shreyas-goenka Could you figure out why this works when the backend returns a 405?

@denik denik added this pull request to the merge queue May 23, 2025
Merged via the queue into main with commit 88b8a17 May 23, 2025
10 checks passed
@denik denik deleted the denik/acc-method-not-allowed branch May 23, 2025 08:39
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