All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.httpmock.builder.RequestBuilder Maven / Gradle / Ivy

There is a newer version: 1.1.9
Show newest version
package com.github.httpmock.builder;

import com.github.httpmock.dto.RequestDto;

public class RequestBuilder {

	private String url;
	private String method;
	private String contentType;

	public RequestBuilder() {
		this.method = "GET";
		this.contentType = null;
	}

	public RequestBuilder url(String url) {
		this.url = url;
		return this;
	}

	public RequestBuilder post(String url) {
		return method("POST").url(url);
	}

	public RequestBuilder get(String url) {
		return method("GET").url(url);
	}

	public RequestBuilder method(String method) {
		this.method = method;
		return this;
	}

	public RequestBuilder contentType(String contentType) {
		this.contentType = contentType;
		return this;
	}

	public RequestDto build() {
		RequestDto requestDto = new RequestDto();
		requestDto.setMethod(method);
		requestDto.setUrl(url);
		requestDto.setContentType(contentType);
		return requestDto;
	}

	public static RequestBuilder request() {
		return new RequestBuilder();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy