ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.43k stars 889 forks source link

GET response with binary file in body #399

Closed datlt4 closed 2 years ago

datlt4 commented 2 years ago

In my code, it have a GET method, and the GET will response a binary file on body of response, but I found that constructor of crow::response only accept std::string, not for unsigned char (because value of bytes are in range 0-255, so use std::string is not suitable). How can I implement the program will receive GET query and get binary file on response with crow library?

The-EDev commented 2 years ago

Hi @LuongTanDat Unfortunately this repository has been abandoned for 4 years, I would recommend you use https://github.com/CrowCpp/Crow instead.

With that being said, std::string and unsigned char* should be able to hold the same data (since in binary -1 and 128 are both 1000 0000). maybe you can use cast the data into a char* and use that to generate an std::string.

datlt4 commented 2 years ago

@The-EDev Many thanks