com.github.hi_fi.httprequestlibrary.domain.ResponseData Maven / Gradle / Ivy
package com.github.hi_fi.httprequestlibrary.domain;
import java.util.HashMap;
import java.util.Map;
import org.apache.http.Header;
import com.github.hi_fi.httprequestlibrary.keywords.Response;
import com.google.gson.Gson;
public class ResponseData {
public int status_code;
public String text;
public String content;
public Object json;
public Map headers = new HashMap();
public void setHeaders(Header[] headerArray) {
for (Header header : headerArray) {
this.headers.put(header.getName(), header.getValue());
}
}
public int getStatusCode() {
return status_code;
}
public void setStatusCode(int status_code) {
this.status_code = status_code;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
this.content = text;
try {
Response response = new Response();
this.json = response.toJson(text);
} catch (Exception e) {
}
}
public String toString() {
return new Gson().toJson(this);
}
}