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

REST client encoding test #10246

Merged
merged 1 commit into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ public TestResource.MyData getDataCdi() {
return restClientInterface.getData();
}

@GET
@Path("encoding")
public String testEmojis() {
return restClientInterface.echo(
"\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00");
}

@GET
@Path("async/cdi/jackson")
@Produces("application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import javax.enterprise.context.Dependent;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
Expand All @@ -16,6 +17,10 @@
@RegisterClientHeaders
public interface RestClientInterface {

@GET
@Path("/echo/{echo}")
String echo(@PathParam("echo") String echo);

@GET
String get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
Expand All @@ -19,6 +20,10 @@ public interface RestInterface {
@GET
String get();

@GET
@Path("/echo/{echo}")
String echo(@PathParam("echo") String echo);

@GET
CompletionStage<String> asyncGet();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ public MyEntity fromJson() throws Exception {
}
}

@GET
@Path("/echo/{echo}")
@Produces("application/json")
public String echo(@PathParam("echo") String echo) {
return echo;
}

@GET
@Path("params/{path}")
public void regularParams(@PathParam("path") String path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ public void testMicroprofileClientCDIIntegration() {
.body(is("TEST"));
}

@Test
public void testEmojis() {
RestAssured.when().get("/client/encoding")
.then().body(is(
"\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00"));
}

@Test
void testMicroprofileClientData() {
JsonPath jsonPath = RestAssured.when().get("/client/manual/jackson").thenReturn().jsonPath();
Expand Down