com.github.dreamhead.moco.handler.StatusCodeResponseHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of moco-core Show documentation
Show all versions of moco-core Show documentation
Moco is an easy setup stub framework, mainly focusing on testing and integration.
package com.github.dreamhead.moco.handler;
import com.github.dreamhead.moco.HttpRequest;
import com.github.dreamhead.moco.MutableHttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
public class StatusCodeResponseHandler extends AbstractHttpResponseHandler {
private final HttpResponseStatus status;
public StatusCodeResponseHandler(final int code) {
status = HttpResponseStatus.valueOf(code);
}
@Override
protected void doWriteToResponse(final HttpRequest httpRequest, final MutableHttpResponse httpResponse) {
httpResponse.setStatus(status.code());
}
}