summaryrefslogtreecommitdiffhomepage
path: root/response.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'response.cpp')
-rw-r--r--response.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/response.cpp b/response.cpp
index ffd72b6..a70a694 100644
--- a/response.cpp
+++ b/response.cpp
@@ -80,6 +80,8 @@ std::unordered_map<std::string, std::function<std::string(RequestContext&)>> Get
{"content_length", [](RequestContext& req_ctx) { return std::to_string(req_ctx.GetReq().body().size()); }},
+ {"content_type", [](RequestContext& req_ctx) { return std::string{req_ctx.GetReq()["content_type"]}; }}, // TODO: does this work?
+
{"method", [](RequestContext& req_ctx) { return std::string{req_ctx.GetReq().method_string()};}},
};
@@ -123,8 +125,10 @@ void SetResponseHeader(const std::string& key, const std::string& value, respons
res.result(unsigned(stoul(value)));
} else if (key == "server") { // Server name/version string
res.set(http::field::server, value);
- } else if (key == "content_type") { // e.g. text/html
+ } else if (key == "content_type") { // e.g. text/html
res.set(http::field::content_type, value);
+ } else if (key == "content_disposition") { // e.g. attachment; ...
+ res.set(http::field::content_disposition, value);
} else
throw std::runtime_error("Unsupported response field: "s + key);
}