Expose scheme in ReactorServerHttpRequest URI
This commit determines fixes ReactorServerHttpRequest.getUri() so that it includes a URL scheme. Issue: SPR-15931
This commit is contained in:
@@ -74,7 +74,8 @@ public class RxNettyServerHttpRequest extends AbstractServerHttpRequest {
|
||||
}
|
||||
|
||||
private static URI createUrl(InetSocketAddress address, String requestUri) throws URISyntaxException {
|
||||
URI baseUrl = new URI(null, null, address.getHostString(), address.getPort(), null, null, null);
|
||||
// TODO: determine scheme
|
||||
URI baseUrl = new URI("http", null, address.getHostString(), address.getPort(), null, null, null);
|
||||
return new URI(baseUrl.toString() + requestUri);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package org.springframework.http.server.reactive;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -27,6 +26,8 @@ import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ServerHttpRequestIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
|
||||
@Override
|
||||
@@ -48,6 +49,7 @@ public class ServerHttpRequestIntegrationTests extends AbstractHttpHandlerIntegr
|
||||
@Override
|
||||
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
|
||||
URI uri = request.getURI();
|
||||
assertEquals("http", uri.getScheme());
|
||||
assertNotNull(uri.getHost());
|
||||
assertNotEquals(-1, uri.getPort());
|
||||
assertNotNull(request.getRemoteAddress());
|
||||
|
||||
Reference in New Issue
Block a user