Commit Graph

180 Commits

Author SHA1 Message Date
Jake Arkinstall
0b90bb486c
Address #534 - handling missing mime types gracefully (#536)
* Added tests for content-type to mime-type detection.

Added a custom_content_types test case that verifies that a user can
specify the mime-type through the contentType parameter upon creation
of a response. If their contentType does not appear in the mime_types
map, but looks like a valid mime type already, it should be used as the
mime type.

Validating against the full list of valid mime types
(https://www.iana.org/assignments/media-types/media-types.xhtml)
would be too intensive, so we merely verify that the parent type
(application, audio, font, text, image, etc) is a valid RFC6838
type, and that the subtype is at least one character. Thus we can
verify that custom/type fails, and incomplete strings such as
image/ and /json fail.
2022-09-12 14:16:16 +03:00
The-EDev
1e0efb0b8b
Added unittest for Host header 2022-08-22 22:32:22 +03:00
The-EDev
0aa3ab94be
fixed unit-tests and warnings 2022-08-22 00:38:03 +03:00
erik
e3f5c5924c Fix compilation error: ambiguous overload
On gcc 5.3.0, you get a compilation error when assigning a lambda
function to a json::wvalue. The compilation error is due to a lambda
function being implicitly convertible to a function pointer, which again
can be implicitly converted to both a bool and a std::function. Avoid
the ambiguity by explicitly casting the lambda to a std::function.
2022-08-05 15:52:52 +02:00
The-EDev
25eefa1711 Addressed code reviews + small tweaks (unit test and paser.done()) 2022-07-22 17:17:38 +03:00
The-EDev
b986d1e38a Find the route as soon as the URL is parsed 2022-07-22 17:17:38 +03:00
Vladislav Oleshko
c6255750e6 Reuse cookie parser constructor 2022-07-10 14:45:40 +03:00
Vladislav
36e59f07ec
Merge branch 'master' into sessions 2022-07-04 12:54:15 +03:00
Vladislav Oleshko
dbfc425916 Add locking test 2022-07-04 12:38:28 +03:00
Vladislav Oleshko
f505c152e1 Remove custom keys 2022-07-04 12:27:25 +03:00
Vladislav Oleshko
cbdb127b98 Small naming fixes 2022-07-04 10:50:14 +03:00
erik
fcd38e7447 Fixed bug: Could not define route for HEAD method
Defining a HEAD method would give HTTP error code 405 (Method Not Allowed) and
calling OPTIONS on the route would return HEAD twice in the Allow header.
2022-06-30 08:07:11 +02:00
Vladislav Oleshko
bd4f7cc847 Add small unittest 2022-06-25 17:16:42 +03:00
Luca Schlecker
d3e19a53ab add initial unittests for utility::string_equals and utility::lexical_cast. 2022-06-18 17:21:37 +03:00
Luca Schlecker
2fbf93e211 replace std::error_code with asio::error_code.
This makes the code more consistent and also reflects the intention a little better.
2022-06-18 17:21:37 +03:00
Luca Schlecker
982e62eabf utility: add string trimming function. 2022-06-18 17:21:37 +03:00
Luca Schlecker
5b1c5a9e9e removing some boost includes, fixing version checks and further phase out boost. 2022-06-18 17:21:37 +03:00
Luca Schlecker
df92d6d639 replace boost::lexical_cast with an equivalent based on std::stringstream. 2022-06-18 17:21:37 +03:00
Luca Schlecker
f3d00bbecf replace boost::asio with standalone asio. 2022-06-18 17:21:37 +03:00
Luca Schlecker
78f764791e remove 'using namespace boost' declarations. 2022-06-18 17:21:37 +03:00
erik
3fe1ee062a Fixed base64 test to not depend on terminating null-characters in binary strings
std::strings with binary data should always be created with the constructor
taking a char pointer and the length of the character data.
2022-06-13 09:27:30 +02:00
erik
f7758feab5 Make stream_response test independent of header size
The test was failing when built using my mingw64-11.2.0 toolset on the Windows
platform, on the 1.0+3 release.
2022-06-13 09:24:33 +02:00
Vladislav Oleshko
946292747e Small fixes 2022-05-23 20:17:49 +03:00
Vladislav
94fa9f77f6
Merge branch 'master' into app-constructor 2022-05-23 20:12:55 +03:00
Farook Al-Sammarraie
a6bf90fa8b
Merge branch 'master' into blueprint-middleware 2022-05-23 09:43:17 +03:00
The-EDev
f2b63f23f5
Fix for issue where app.stop() blocks when a websocket is open 2022-05-20 14:14:55 +03:00
Farook Al-Sammarraie
3e6c097733
Merge branch 'master' into #421-Websockets-should-support-a-maximum-payload 2022-05-18 20:04:38 +03:00
The-EDev
564b070d5f Made test port static and replaced REQUIRE with CHECK and if
Using port 0 seems to cause the test to be blocked
Also added methods and status codes to Crow's documentation
2022-05-18 15:57:46 +03:00
konrad
7e4f57486c Add extra log when status code is not defined.
Just to document behaviour when returning status that is
not well-known.
2022-05-18 15:57:46 +03:00
Farook Al-Sammarraie
e7007cfbce
Merge branch 'master' into blueprint-middleware 2022-05-18 13:30:13 +03:00
The-EDev
94a0c3555a
formatting 2022-05-16 19:32:33 +03:00
The-EDev
0f6bfb04ee
added documentation and unit test 2022-05-16 19:15:34 +03:00
The-EDev
c7001f81fc Removed test print 2022-05-14 12:05:06 +03:00
The-EDev
78c7186897 Allowed Crow class to be passed to Websocket connection object 2022-05-14 12:05:06 +03:00
Vladislav
4d4d0094fe
Merge branch 'master' into blueprint-middleware 2022-05-07 23:03:35 +03:00
Vladislav Oleshko
51bb6062ef Rename format, refactor dump 2022-05-07 12:09:22 +03:00
Vladislav Oleshko
a01e39cf5d Use std::tm instead of boost 2022-05-07 12:09:22 +03:00
Vladislav Oleshko
e15675f74e Add cookie formatting tests 2022-05-07 12:09:22 +03:00
Farook Al-Sammarraie
b6a04058a1
Merge branch 'master' into gcc48 2022-04-25 09:34:52 +03:00
Dan Keenan
bdfd9cb6a9 Create failing test. 2022-04-16 17:31:12 -04:00
The-EDev
9f7ed83c45
Removed is_callable in favor of CallHelper + formatting 2022-04-16 16:04:49 +03:00
Vladislav Oleshko
74d94888d1 Generic app constructor 2022-04-13 20:49:22 +03:00
Vladislav Oleshko
d86b2d36f1 Add test, small fixes 2022-04-13 12:16:06 +03:00
Vladislav
cca8578556
Merge branch 'master' into blueprint-middleware 2022-04-12 10:52:45 +03:00
Vladislav Oleshko
3b9e522523 Blueprint middleware prototype 2022-04-11 16:01:27 +03:00
The-EDev
facae48aa1
Allowed compiling on GCC 4.8 by using CallHelper instead of is_callable
Also fixed issue with ssl test string comparison (which caused random incorrect failures)
2022-04-11 06:24:43 +03:00
Luca Schlecker
44f51f4750 Crow's current features (ssl and compression) can now be enabled through 'CROW_FEATURES' instead of their own CMake variables.
The default features are the ones Crow was installed with but can be overridden by setting 'CROW_FEATURES' before the 'find_package' call.

Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2022-04-04 20:36:57 +02:00
The-EDev
69feb9c226
Formatting 2022-03-16 21:15:18 +03:00
The-EDev
c858078b4e
Fixed test porblem 2022-03-16 18:45:31 +03:00
The-EDev
c0062bd2e7
added run_async method
also added unit tests for #358
2022-03-10 15:44:39 +03:00