From ad92655eabdc58480fb9f209056610575e683521 Mon Sep 17 00:00:00 2001 From: Carsten Kragelund Date: Wed, 2 Aug 2023 19:51:51 +0200 Subject: [PATCH] docs: remove note about string body --- NOTES.org | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/NOTES.org b/NOTES.org index 46702b0..721d1d4 100644 --- a/NOTES.org +++ b/NOTES.org @@ -17,14 +17,3 @@ Though that might just be my Rust brain, and this is more common with JS tools * =rapid run= seems to recompile too often Even when changing a non-backend file, rapid run will rebuild the entire backend/regenerate the types. This is not really a problem as its extremely fast, but it does mean the console updates with the build information even for non-backend changes. This includes documentation files too like this =NOTES.org= or the =README.md= - -* Body in POST request handlers -Unsure how to properly handle the incoming data on the Rust side. Used the following snippets to accept any arbitrary bytes and then convert them to a string. -#+BEGIN_SRC rust -#[rapid_handler] -pub async fn post(bytes: Bytes) -> HttpResponse { - let body = String::from_utf8(bytes.to_vec()).unwrap(); - // ... -} -#+END_SRC -This is obviously not ideal, since the actual request handler has to manage errors arising from non-utf8 data or if there has to be structured data such as JSON.