Skip to content

Commit

Permalink
server : fix crash when error handler dumps invalid utf-8 json (ggerg…
Browse files Browse the repository at this point in the history
  • Loading branch information
kaetemi authored and arthw committed Nov 15, 2024
1 parent 0a88e46 commit 88fa42c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2572,7 +2572,7 @@ int main(int argc, char ** argv) {

auto res_error = [](httplib::Response & res, json error_data) {
json final_response {{"error", error_data}};
res.set_content(final_response.dump(), MIMETYPE_JSON);
res.set_content(final_response.dump(-1, ' ', false, json::error_handler_t::replace), MIMETYPE_JSON);
res.status = json_value(error_data, "code", 500);
};

Expand Down

0 comments on commit 88fa42c

Please sign in to comment.