Skip to content

MockHttpRequest to support ClientRequestInterceptor testing [SPR-7995] #12650

Closed
@spring-projects-issues

Description

@spring-projects-issues

Keith Donald opened SPR-7995 and commented

public class MockHttpRequest implements HttpRequest {

	private final HttpHeaders headers = new HttpHeaders();

	private HttpMethod method;
	
	private URI uri;

	public MockHttpRequest(String uri) {
		this(HttpMethod.GET, uri);
	}

	public MockHttpRequest(HttpMethod method, String uri) {
		try {
			this.uri = new URI(uri);
		} catch (URISyntaxException e) {
			throw new IllegalArgumentException("Invalid uri: '"+ uri + "'", e);
		}
		this.method = method;
	}
	
	public HttpHeaders getHeaders() {
		return headers;
	}

	public HttpMethod getMethod() {
		return method;
	}

	public URI getURI() {
		return uri;
	}

}

Affects: 3.1 M1

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions