diff --git a/lib/inc/drogon/HttpTypes.h b/lib/inc/drogon/HttpTypes.h index dada5573..d435715b 100644 --- a/lib/inc/drogon/HttpTypes.h +++ b/lib/inc/drogon/HttpTypes.h @@ -89,6 +89,7 @@ enum ContentType CT_APPLICATION_FONT_WOFF, CT_APPLICATION_FONT_WOFF2, CT_APPLICATION_VND_MS_FONTOBJ, + CT_APPLICATION_PDF, CT_IMAGE_SVG_XML, CT_IMAGE_PNG, CT_IMAGE_JPG, diff --git a/lib/src/HttpUtils.cc b/lib/src/HttpUtils.cc index da4d00a2..91412440 100644 --- a/lib/src/HttpUtils.cc +++ b/lib/src/HttpUtils.cc @@ -106,6 +106,11 @@ const string_view &webContentTypeToString(ContentType contenttype) "Content-Type: application/vnd.ms-fontobject\r\n"; return sv; } + case CT_APPLICATION_PDF: + { + static string_view sv = "Content-Type: application/pdf\r\n"; + return sv; + } case CT_IMAGE_PNG: { static string_view sv = "Content-Type: image/png\r\n"; @@ -443,6 +448,8 @@ ContentType getContentType(const std::string &fileName) case 'p': if (extName == "png") return CT_IMAGE_PNG; + else if(extName == "pdf") + return CT_APPLICATION_PDF; break; case 's': if (extName == "svg")