Skip to content

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

Closed

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:

Activity

  1. spring-projects-issues commented on Oct 5, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Rossen Stoyanchev commented

    Commit 5c13739afafcd45471e1954c5e05c3cfa2e723da adds MockClientHttpRequest and MockClientHttpResponse.

  2. added
    type: enhancement
    in: web
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions