Modify parseContentType function (#518)

This commit is contained in:
An Tao 2020-07-25 10:01:06 +08:00 committed by GitHub
parent 5bd85170bf
commit 34cefefce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -70,7 +70,7 @@ int main()
Drogon provides some interfaces for adding controller logic directly in the main() function, for example, user can register a handler like this in Drogon: Drogon provides some interfaces for adding controller logic directly in the main() function, for example, user can register a handler like this in Drogon:
```c++ ```c++
app.registerHandler("/test?username={name}", app().registerHandler("/test?username={name}",
[](const HttpRequestPtr& req, [](const HttpRequestPtr& req,
std::function<void (const HttpResponsePtr &)> &&callback, std::function<void (const HttpResponsePtr &)> &&callback,
const std::string &name) const std::string &name)

View File

@ -70,7 +70,7 @@ int main()
当然Drogon也提供了一些接口使用户可以在main()函数中直接添加控制器逻辑比如用户可以注册一个lambda处理器到drogon框架中如下所示 当然Drogon也提供了一些接口使用户可以在main()函数中直接添加控制器逻辑比如用户可以注册一个lambda处理器到drogon框架中如下所示
```c++ ```c++
app.registerHandler("/test?username={name}", app().registerHandler("/test?username={name}",
[](const HttpRequestPtr& req, [](const HttpRequestPtr& req,
std::function<void (const HttpResponsePtr &)> &&callback, std::function<void (const HttpResponsePtr &)> &&callback,
const std::string &name) const std::string &name)

View File

@ -1,6 +1,6 @@
/** /**
* *
* HttpUtils.h * @file HttpUtils.h
* An Tao * An Tao
* *
* Copyright 2018, An Tao. All rights reserved. * Copyright 2018, An Tao. All rights reserved.
@ -567,7 +567,8 @@ ContentType parseContentType(const string_view &contentType)
{"image/bmp", CT_IMAGE_BMP}, {"image/bmp", CT_IMAGE_BMP},
{"image/icns", CT_IMAGE_ICNS}, {"image/icns", CT_IMAGE_ICNS},
{"application/wasm", CT_APPLICATION_WASM}, {"application/wasm", CT_APPLICATION_WASM},
{"text/plain", CT_TEXT_PLAIN}}; {"text/plain", CT_TEXT_PLAIN},
{"multipart/form-data", CT_MULTIPART_FORM_DATA}};
auto iter = map_.find(contentType); auto iter = map_.find(contentType);
if (iter == map_.end()) if (iter == map_.end())
return CT_NONE; return CT_NONE;