Small fixes after merge

namespace v0.6_testing
mbandic 1 year ago
parent c2e9ede9bc
commit 881185d03a
  1. 1
      lib/http.hpp
  2. 3
      src/http.cpp
  3. 26
      test/test.cpp
  4. BIN
      test/test.o

@ -15,7 +15,6 @@ class api;
class http_request { class http_request {
public: public:
string protocol; string protocol;
string protocol;
string method; string method;
string url; string url;
map<string, string> headers; map<string, string> headers;

@ -86,8 +86,7 @@ http_response::http_response(const http_response_code _status, const string _bod
status = to_string(_status) + " " + http_response_code_txt(_status); status = to_string(_status) + " " + http_response_code_txt(_status);
if (!_body.empty()) { if (!_body.empty()) {
body = _body; body = _body;
// kad merge s header-response branch možeš omogućit ovu liniju this->header("Content-Length", to_string(body.length()));
// this->header("Content-Length", to_string(body.length()));
} }
protocol = get_protocol(_protocol); protocol = get_protocol(_protocol);
mold(); mold();

@ -8,23 +8,17 @@ int main() {
try { try {
<<<<<<< HEAD api uf(GET, "/delete", {make_pair("id", "4")}, "bay");
api uf(GET, "delete", {make_pair("id", "4")}, "bay");
http_request myreq(&uf); http_request myreq(&uf);
myreq.putheader("Content-type", "text/plain"); myreq.header("Content-type", "text/plain");
=======
// api uf(&myApi, GET, "/delete", {make_pair("id", "4")}, "bay");
// http_request myreq(&uf);
// myreq.header("Content-type", "text/plain");
>>>>>>> http-status-code
// cout << myreq.raw << endl; cout << myreq.raw << endl;
// cout << myreq.protocol << endl; cout << myreq.protocol << endl;
// // cout << myreq.status << endl; // cout << myreq.status << endl;
// for(auto i : myreq.headers) for(auto i : myreq.headers)
// cout << i.first << " " << i.second << endl; cout << i.first << " " << i.second << endl;
// cout << myreq.body << endl; cout << myreq.body << endl;
http_response myres2(OK, "nnotauth", "1.0" ); http_response myres2(OK, "nnotauth", "1.0" );
@ -33,7 +27,9 @@ int main() {
cout << myres2.headers["Content-Length"] << endl; cout << myres2.headers["Content-Length"] << endl;
cout << myres2.body << endl; cout << myres2.body << endl;
} catch (const string err) {
cout << err << endl;
}
// http myHttp(&myApi, "GET /fghfhf HTTP/1.1\r\nBaba"); // http myHttp(&myApi, "GET /fghfhf HTTP/1.1\r\nBaba");

Binary file not shown.
Loading…
Cancel
Save