2025-02-03 18:39:23 +01:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* HttpResponse.hpp :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2025/02/03 17:21:20 by mmoussou #+# #+# */
|
2025-02-11 07:41:56 +01:00
|
|
|
/* Updated: 2025/02/08 05:06:57 by mmoussou ### ########.fr */
|
2025-02-03 18:39:23 +01:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#ifndef __REQUESTS_HTTP_RESPONSE_HPP__
|
|
|
|
# define __REQUESTS_HTTP_RESPONSE_HPP__
|
|
|
|
|
|
|
|
#include "requests/default.hpp"
|
|
|
|
|
2025-02-11 07:41:56 +01:00
|
|
|
class IHttpResponse {
|
2025-02-03 18:39:23 +01:00
|
|
|
public:
|
2025-02-11 07:41:56 +01:00
|
|
|
void parseRequest(const HttpRequest &request) = 0;
|
2025-02-03 18:39:23 +01:00
|
|
|
|
|
|
|
std::string str(void) const;
|
|
|
|
|
2025-02-11 07:41:56 +01:00
|
|
|
protected:
|
2025-02-03 18:39:23 +01:00
|
|
|
std::string _protocol;
|
|
|
|
size_t _status_code;
|
|
|
|
std::string _status_text;
|
|
|
|
std::map<std::string, std::string> _headers;
|
|
|
|
std::string _body;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2025-02-11 07:41:56 +01:00
|
|
|
class HttpGet: public IHttpResponse {
|
|
|
|
public:
|
|
|
|
HttpGet(void);
|
|
|
|
HttpGet(const HttpRequest &request);
|
|
|
|
~HttpResponse(void);
|
|
|
|
|
|
|
|
void parseRequest(const HttpRequest &request);
|
|
|
|
}
|
|
|
|
|
2025-02-03 18:39:23 +01:00
|
|
|
#endif
|