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

com.lyncode.testy.http.TestyHttpResponse Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package com.lyncode.testy.http;

import org.apache.commons.io.IOUtils;
import org.apache.http.Header;
import org.apache.http.HttpResponse;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

public class TestyHttpResponse {
    private final String content;
    private HttpResponse response;

    public TestyHttpResponse(HttpResponse response) {
        this.response = response;
        try {
            this.content = IOUtils.toString(response.getEntity().getContent());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String content() {
        return content;
    }

    public int statusCode() {
        return response.getStatusLine().getStatusCode();
    }

    public List
headers() { return Arrays.asList(response.getAllHeaders()); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy