I'm failing to set an Origin header with a WebClient. Here's the
client side code, and the header does not make it to the other end.
This makes it rather difficult to write tests for CORS.
On the other hand, should WebClient have native support for the client
side of CORS? That's complex and unpleasant in prospect.
String origin = "http://localhost:" + PORT;
WebClient wc = WebClient.create(origin + "/");
// Since our WebClient doesn't know from Origin, we need to do
this ourselves.
wc.header("Origin", origin);
Response r =
wc.replacePath("/simpleGet/HelloThere").accept("text/plain").get();
assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());