You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran app.run(port = 8080) which opened the docs page in browser. Clicking the Try button under Predict POST request produces a prediction (200 OK). However, the R shiny app displays the error HTTP 422 Unprocessable Entity. I then ran the code outside of shiny:
httr2::request("http://127.0.0.1:8080/predict") |>
httr2::req_body_json(list(
bill_length_mm = 30,
species_Chinstrap = "Adelie" == "Chinstrap",
species_Gentoo = "Adelie" == "Gentoo",
sex_male = "Male" == "Male"
)) |>
httr2::req_perform()
Error in `httr2::req_perform()`:
! HTTP 422 Unprocessable Entity.
Run `rlang::last_trace()` to see where the error occurred.
curl -X POST "http://127.0.0.1:8080/predict" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '[{"bill_length_mm":39.1,"species_Chinstrap":false,"species_Gentoo":true,"sex_male":true}]' \
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 121 100 32 100 89 6294 17505 --:--:-- --:--:-- --:--:-- 30250{"predict":[5083.6963092196365]}
httr2::request("http://127.0.0.1:8080/predict") |>
httr2::req_method("POST") |>
httr2::req_headers(
Accept = "application/json",
) |>
httr2::req_body_raw("[{bill_length_mm:39.1,species_Chinstrap:false,species_Gentoo:true,sex_male:true}]", "application/json") |>
httr2::req_perform()
Error in `httr2::req_perform()`:
! HTTP 422 Unprocessable Entity.
Run `rlang::last_trace()` to see where the error occurred.
I am not sure what is going wrong with httr2. Any ideas?
The text was updated successfully, but these errors were encountered:
I ran
app.run(port = 8080)
which opened the docs page in browser. Clicking the Try button under Predict POST request produces a prediction (200 OK). However, the R shiny app displays the errorHTTP 422 Unprocessable Entity
. I then ran the code outside of shiny:Dry Run
I checked that the request is correct:
CURL
Running curl works:
So, I translated that to
httr2
syntax:But even that throws the same error:
I am not sure what is going wrong with
httr2
. Any ideas?The text was updated successfully, but these errors were encountered: