-
Notifications
You must be signed in to change notification settings - Fork 17
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
Implement binary protocol between client and server #297
base: 2.5.x
Are you sure you want to change the base?
Conversation
This commit introduces a custom protocol for communicating between the client and the server. Instead of using JSON, it now uses a binary protocol. This removes the requirement of having Micronaut JSON on the user classpath (on the client side) and further reduces the number of dependencies of the server. This is a major breaking change, and it's no longer possible to directly use tools like cURL or httpie to talk to the server. This is blocked by micronaut-projects/micronaut-core#9331
Sonar analysis seems completely off. |
public void writeTo(Argument<T> type, MediaType mediaType, T object, MutableHeaders outgoingHeaders, OutputStream outputStream) throws CodecException { | ||
try { | ||
var dos = new DataOutputStream(outputStream); | ||
outgoingHeaders.set("Content-Type", TEST_RESOURCES_BINARY_MEDIA_TYPE); |
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.
you can use the HttpHeaders
type that has constants for this
outgoingHeaders.set("Content-Type", TEST_RESOURCES_BINARY_MEDIA_TYPE); | ||
TestResourcesCodec.writeObject(object, dos); | ||
} catch (IOException e) { | ||
throw new CodecException("Invalid binary stream", e); |
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 make these error messages more descriptive so we know it is coming from test resources
SonarCloud Quality Gate failed. |
This commit introduces a custom protocol for communicating between the client and the server. Instead of using JSON, it now uses a binary protocol. This removes the requirement of having Micronaut JSON on the user classpath (on the client side) and further reduces the number of dependencies of the server.
This is a major breaking change, and it's no longer possible to directly use tools like cURL or httpie to talk to the server.
This is blocked by micronaut-projects/micronaut-core#9331