protocol: provide default response code for custom request jobs

This commit is contained in:
deepak1556 2017-05-03 16:48:02 +05:30 committed by Kevin Sawicki
parent 190c9c916e
commit 3c88447be6
3 changed files with 43 additions and 4 deletions

View file

@ -82,6 +82,9 @@ class JsAsker : public RequestJob {
base::Bind(&JsAsker::OnResponse,
weak_factory_.GetWeakPtr())));
}
int GetResponseCode() const override { return 200; }
void GetResponseInfo(net::HttpResponseInfo* info) override {
info->headers = new net::HttpResponseHeaders("");
}

View file

@ -67,7 +67,7 @@ void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
}
void URLRequestBufferJob::GetResponseInfo(net::HttpResponseInfo* info) {
std::string status("HTTP/1.1 ");
std::string status("HTTP/1.1 200 OK");
status.append(base::IntToString(status_code_));
status.append(" ");
status.append(net::GetHttpReasonPhrase(status_code_));