Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
dSS - digitalSTROM Server
dss-mainline
Commits
baa37583
Commit
baa37583
authored
5 years ago
by
Branislav Katreniak
Browse files
Options
Download
Patches
Plain Diff
dsConnectorHttpServer: fail on unknown http method
parent
43b3b435
master
DSD-10252-heatbeat-increase-for-dutch-p1-support
DSD-10490-crash
DSD-11013-wrong-dutch-translation
DSD-7417
JEAN_P1_MASTER
MR_GroupID_instead_DeviceClasses
MR_convert_deviceinterfaceqeuesthandler_test
MR_cross-compile_dss20
MR_device_AutomationInputMode_none
MR_device_setBinaryType
MR_docker-dss11gb-toolchain
MR_drop_boost_filesystem
MR_getModelFeatures2
MR_hardwareType_cleanup
MR_install_libds_as_shared_library
MR_metering_storage
MR_metering_webscocket
MR_open_metering_system_archive
MR_openapi_configuration
MR_p1_metering
MR_pairing-button_3
MR_prepare_public_api_sync
MR_produced-energy
MR_std--shared_ptr
MR_sync_open_metering_system
R1911
R2002
R2004
R2006
R2008
R2011
R2102
R2106
R2111
R2204
R2207
R2210
R2303
R2309
R2311
R2411
bka-docker
bugfix/DSD-10490-fix-crash
bugfix/DSD-3172-support-umr200-config_3_7_0
cherry-pick-76f3d2ce
cherry-pick-921e00cb
cherry-pick-921e00cb-2
feature/DSD-10170-support-area-names
jeanvisagie/dss-mainline-p1_crc
mock_api_endpoints
no_proxy
revert-c81752f2
testing
testing_safe
update_ubuntu
weather_api
1.19.11
1.19.11-beta01
1.19.10.1
1.19.10.1-beta01
1.19.10
1.19.9
1.19.9-beta03
1.19.9-beta02
1.19.9-beta01
1.19.8.1
1.19.8
1.19.8-beta03
1.19.8-beta02
1.19.8-beta01
1.19.7.1
1.19.7
1.19.7-beta07
1.19.7-beta06
1.19.7-beta05
1.19.7-beta04
1.19.7-beta03
1.19.7-beta02
1.19.7-beta01
1.19.6.3
1.19.6.2
1.19.6.1
1.19.6.1-beta01
1.19.6
1.19.6-beta03
1.19.6-beta02
1.19.6-beta01
1.19.5.1
1.19.5.1-beta02
1.19.5.1-beta01
1.19.5
1.19.5-beta03
1.19.5-beta02
1.19.5-beta01
1.19.4
1.19.4-beta04
1.19.4-beta03
1.19.4-beta02
1.19.4-beta01
1.19.3.1
1.19.3.1-beta01
1.19.3
1.19.3-beta06
1.19.3-beta05
1.19.3-beta04
1.19.3-beta03
1.19.3-beta02
1.19.3-beta01
1.19.2.1
1.19.2
1.19.2-beta02
1.19.2-beta01
1.19.1
1.19.1-beta02
1.19.1-beta01
1.19.0
1.19.0-beta03
1.19.0-beta02
1.19.0-beta01
1.18.0
1.18.0-beta04
1.18.0-beta03
1.18.0-beta02
1.18.0-beta01
1.17.0
1.17.0-beta05
1.17.0-beta04
1.17.0-beta03
1.17.0-beta02
1.17.0-beta01
1.16.7
1.16.7-beta04
1.16.7-beta03
1.16.7-beta02
1.16.7-beta01
1.16.6.1
1.16.6.1-beta01
1.16.6
1.16.6-beta04
1.16.6-beta03
1.16.6-beta02
1.16.6-beta01
1.16.5
1.16.5-beta07
1.16.5-beta06
1.16.5-beta05
1.16.5-beta04
1.16.5-beta03
1.16.5-beta02
1.16.5-beta01
1.16.4
1.16.4-beta06
1.16.4-beta05
1.16.4-beta04
1.16.4-beta03
1.16.4-beta02
1.16.4-beta01
1.16.3
1.16.3-beta08
1.16.3-beta07
1.16.3-beta06
1.16.3-beta05
1.16.3-beta04
1.16.3-beta03
1.16.3-beta02
1.16.3-beta01
1 merge request
!1838
Bka ds connector
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ds-connector/http-server-test.cpp
+22
-0
src/ds-connector/http-server-test.cpp
src/ds-connector/http-server.cpp
+1
-1
src/ds-connector/http-server.cpp
with
23 additions
and
1 deletion
+23
-1
src/ds-connector/http-server-test.cpp
+
22
−
0
View file @
baa37583
...
...
@@ -103,6 +103,28 @@ SCENARIO("dsConnectorHttpServer", TAGS) {
SUCCEED
();
}
}
THEN
(
"Unknown verb returns error"
)
{
auto
request
=
http
::
request
<
http
::
string_body
>
{};
request
.
version
(
11
);
request
.
method_string
(
"unknown"
);
request
.
target
(
"/"
);
request
.
prepare_payload
();
http
::
async_write
(
socket
,
request
,
[
&
](
error_code
ec
,
std
::
size_t
)
{
loop
.
stop
();
});
loop
.
run
();
auto
buffer
=
boost
::
beast
::
flat_buffer
{};
auto
response
=
http
::
response
<
http
::
string_body
>
{};
http
::
async_read
(
socket
,
buffer
,
response
,
[
&
](
error_code
ec
,
std
::
size_t
)
{
CHECK
(
response
.
version
()
==
11
);
CHECK
(
response
.
result
()
==
http
::
status
{
500
});
CHECK
(
response
[
http
::
field
::
content_type
]
==
"application/json"
);
CHECK
(
response
.
body
().
find
(
"Unknown ::dsApi::HttpMethod enum option"
)
!=
std
::
string
::
npos
);
loop
.
stop
();
});
loop
.
run
();
SUCCEED
();
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/ds-connector/http-server.cpp
+
1
−
1
View file @
baa37583
...
...
@@ -70,7 +70,7 @@ private:
self
->
m_router
.
asyncInvoke
(
dsApi
::
HttpRequest
{
.
path
=
std
::
string
{
path
},
.
httpArgs
=
{.
method
=
ds
::
to
Enum
<
dsApi
::
HttpMethod
>
(
request
->
method_string
()),
.
httpArgs
=
{.
method
=
ds
::
require
Enum
<
dsApi
::
HttpMethod
>
(
request
->
method_string
()),
.
content
=
request
->
body
().
size
()
?
ds
::
fromJson
<
ds
::
JsonFragment
>
(
request
->
body
())
:
ds
::
JsonFragment
{},
.
query
=
std
::
string
{
query
},
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets