Modify parseContentType function (#518)
This commit is contained in:
parent
5bd85170bf
commit
34cefefce4
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue