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

io.github.juniqlim.apicall.http.HttpResponse Maven / Gradle / Ivy

There is a newer version: 0.0.14
Show newest version
package io.github.juniqlim.apicall.http;

import org.springframework.http.HttpStatus;

/**
 * interface
 */
public class HttpResponse {
    private final HttpStatus httpStatus;
    private final String body;

    private HttpResponse(HttpStatus httpStatus, String body) {
        this.httpStatus = httpStatus;
        this.body = body;
    }

    public static HttpResponse of(HttpStatus httpStatus, String body) {
        return new HttpResponse(httpStatus, body);
    }

    public HttpStatus httpStatus() {
        return httpStatus;
    }

    public String body() {
        return body;
    }

    public boolean isError() {
        return httpStatus.is4xxClientError() || httpStatus.is5xxServerError();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy