Skip to content

Conversation

mposolda
Copy link
Contributor

@mposolda mposolda commented Jul 31, 2025

@geoand geoand changed the title HEAD returned 405 in the REST resource in some cases Fix Quarkus REST issue where HEAD returned 405 Jul 31, 2025

This comment has been minimized.

Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

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

This is probably correct, but I find the repeated calls to findRequestMatch hard to read, in two cases it looks like we may be invoking it several times in a row with the same parameters. Perhaps there's a way to rewrite it more clearly?

boolean hadNullMethodMapper = false;
if (mapper == null) {
mapper = target.get(null); //another layer of resource locators maybe
// we set this without checking if we matched, but we only use it after
// we check for a null mapper, so by the time we use it, it must have meant that
// we had a matcher for a null method
hadNullMethodMapper = true;
res = findRequestMatch(mapper, requestContext);
Copy link
Member

Choose a reason for hiding this comment

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

Here it seems we're invoking findRequestMatch() again discarding the first value of res, but probably this only happens when mapper was null so res was also null. It makes it a bit hard to read, though.

RequestMapper.RequestMatch<RuntimeResource> res = mapper
.map(requestContext.getRemaining().isEmpty() ? "/" : requestContext.getRemaining());
if (res == null) {
res = findRequestMatch(mapper, requestContext);
Copy link
Member

Choose a reason for hiding this comment

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

This again looks like we could invoke findRequestMatch() twice with the same parameters, if it returned null the first time.

@mposolda mposolda force-pushed the 49172-resteasy-head-bug branch from 2ceaf35 to 874aaae Compare July 31, 2025 17:20
@mposolda
Copy link
Contributor Author

@FroMage Thanks for the review! I've tried to make it that findRequestMatch is not called multiple times with the same mapper, but agree that code was maybe harder to follow and could possibly happen that it is called with same mapper two times in the 2nd case you mentioned.

I've rewrote this block a bit. It is more changes in the PR, but hopefully now it is more clear that findRequestMatch is never called multiple times with same mapper argument. What do you think now?

@mposolda mposolda requested a review from FroMage July 31, 2025 17:28
Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

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

Thanks, that's easier to understand :)

@FroMage FroMage added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Aug 1, 2025

This comment has been minimized.

@geoand
Copy link
Contributor

geoand commented Aug 1, 2025

The CI failures are likely unrelated to the PR as similar failures can be seen in other PRs as well

@FroMage
Copy link
Member

FroMage commented Aug 1, 2025

That's a lot of failures, though 😲

@gastaldi gastaldi force-pushed the 49172-resteasy-head-bug branch from 874aaae to 0702c4a Compare August 6, 2025 18:51
Copy link

quarkus-bot bot commented Aug 6, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 0702c4a.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 17

📦 extensions/quartz/deployment

io.quarkus.quartz.test.timezone.TriggerPrevFireTimeZoneTest.testScheduledJobs - History

  • expected: <2025-08-06T19:53:40Z> but was: <2025-08-06T19:53:41Z> - org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError: expected: <2025-08-06T19:53:40Z> but was: <2025-08-06T19:53:41Z>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1145)
	at io.quarkus.quartz.test.timezone.TriggerPrevFireTimeZoneTest.testScheduledJobs(TriggerPrevFireTimeZoneTest.java:71)

@FroMage FroMage merged commit fb5b21c into quarkusio:main Aug 7, 2025
52 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.26 - main milestone Aug 7, 2025
@quarkus-bot quarkus-bot bot added kind/bugfix and removed triage/waiting-for-ci Ready to merge when CI successfully finishes labels Aug 7, 2025
@gsmet gsmet modified the milestones: 3.26 - main, 3.25.2 Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resteasy-reactive: HEAD returns 405 in the REST resource in some cases
4 participants