-
Notifications
You must be signed in to change notification settings - Fork 79
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
Expose styx service providers in admin interface #505
Expose styx service providers in admin interface #505
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! 👍 I've left very minor comments only.
components/proxy/src/test/java/com/hotels/styx/admin/handlers/ServiceProviderHandlerTest.java
Show resolved
Hide resolved
components/proxy/src/test/java/com/hotels/styx/admin/handlers/ServiceProviderHandlerTest.java
Outdated
Show resolved
Hide resolved
components/proxy/src/test/java/com/hotels/styx/admin/handlers/ServiceProviderHandlerTest.java
Outdated
Show resolved
Hide resolved
system-tests/ft-suite/src/test/kotlin/com/hotels/styx/admin/OriginsFileCompatibilitySpec.kt
Outdated
Show resolved
Hide resolved
components/proxy/src/test/java/com/hotels/styx/admin/handlers/ServiceProviderHandlerTest.java
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/handlers/ServiceProviderHandler.java
Outdated
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/handlers/ServiceProviderHandler.java
Outdated
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/handlers/ServiceProviderHandler.java
Outdated
Show resolved
Hide resolved
HttpResponse response = Mono.from(handler.handle(request, HttpInterceptorContext.create())).block(); | ||
|
||
assertThat(response.status(), equalTo(HttpResponseStatus.NO_CONTENT)); | ||
assertThat(response.contentLength().get(), equalTo(0L)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't particularly like the Exception message when we call get() on an optional. Maybe we could have a nicer assertion message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps assert isPresent()
beforehand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, actually it seems a NO_CONTENT response should not have a content-length header at all, even one set to 0. So I'll fix that, and check for its absence.
https://tools.ietf.org/html/rfc7230#section-3.3.2
A server MUST NOT send a Content-Length header field in any response
with a status code of 1xx (Informational) or 204 (No Content).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we intentionally let it have "Content-Length: 0" here as it seems otherwise the client was getting 'Transfer-Encoding: chunked' otherwise and that broke everything apart. If I recall correctly, we thought the header was added by Netty but we didn't really verify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a quick check of the running server, I didn't get a Transfer-Encoding: chunked
header when a zero-content response was returned. Maybe the admin server's netty is set up differently to the main proxy server?
See Issue #494