junit-servers-core/src/main/java/com/github/mjeanroy/junit/servers/client/impl/okhttp3/OkHttpRequest.java
private RequestBody createBody() {
		RequestBody rqBody = null;

		// Try request body first.
		if (body != null && !body.isEmpty()) {
			rqBody = RequestBody.create(null, body);
		}
		else if (!formParams.isEmpty()) {
			FormBody.Builder builder = new FormBody.Builder();
			for (HttpParameter parameter : formParams.values()) {
				String encodedName = parameter.getEncodedName();
				String encodedValue = firstNonNull(parameter.getEncodedValue(), "");
				builder.addEncoded(encodedName, encodedValue);
			}

			rqBody = builder.build();
		}

		return rqBody;
	}
private RequestBody createBody() {
		RequestBody rqBody = null;

		// Try request body first.
		if (body != null && !body.isEmpty()) {
			rqBody = RequestBody.create(null, body);
		}
		else if (!formParams.isEmpty()) {
			FormBody.Builder builder = new FormBody.Builder();
			for (HttpParameter parameter : formParams.values()) {
				String encodedName = parameter.getEncodedName();
				String encodedValue = firstNonNull(parameter.getEncodedValue(), "");
				builder.addEncoded(encodedName, encodedValue);
			}

			rqBody = builder.build();
		}

		return rqBody;
	}
private RequestBody createBody ( ) { RequestBody rqBody = null ; // Try request body first. if ( body != null && ! body . isEmpty ( ) ) { rqBody = RequestBody . create ( null , body ) ; } else if ( ! formParams . isEmpty ( ) ) { FormBody . Builder builder = new FormBody . Builder ( ) ; for ( HttpParameter parameter : formParams . values ( ) ) { String encodedName = parameter . getEncodedName ( ) ; String encodedValue = firstNonNull ( parameter . getEncodedValue ( ) , "" ) ; builder . addEncoded ( encodedName , encodedValue ) ; } rqBody = builder . build ( ) ; } return rqBody ; }
Create the OkHttp request body:
<ul>
<li>Create body from {@link #body} value if it is defined.</li>
<li>Create {@link FormBody} from {@link #formParams} otherwise if it is not empty.</li>
<li>Returns {@code null} otherwise.</li>
</ul>

@return OkHttp {@link RequestBody} instance.
@see RequestBody#create(MediaType, String)
@see FormBody
Create the OkHttp request body : <ul > <li > Create body from { @link #body } value if it is defined . < / li > <li > Create { @link FormBody } from { @link #formParams } otherwise if it is not empty . < / li > <li > Returns { @code null } otherwise . < / li > < / ul >