1
0
Fork 0
mirror of https://git.42l.fr/neil/sncf.git synced 2024-04-30 21:22:44 +02:00

moving to forms OCSv2 API

This commit is contained in:
neil 2020-09-08 18:48:47 +02:00
parent 9f304c4069
commit abd6c91013
2 changed files with 3 additions and 3 deletions

View file

@ -70,7 +70,7 @@ pub async fn forward(
// sparing the use of a mutable body when not needed
// For now, the body only needs to be modified when the route
// is "create a new form" route
if route == "/apps/forms/api/v1/form" {
if route == "/ocs/v2.php/apps/forms/api/v1/form" {
// retreive the body from the request result
let response_body = res.body().limit(PAYLOAD_LIMIT).await.map_err(|e| {
eprintln!("error_forward_resp: {}", e);
@ -90,7 +90,7 @@ pub async fn forward(
r#"{{"id":{},"keyValuePairs":{{"isAnonymous":true}}}}"#,
form_id
);
let update_req = forge_from("/apps/forms/api/v1/form/update", &req, &url, &client)
let update_req = forge_from("/ocs/v2.php/apps/forms/api/v1/form/update", &req, &url, &client)
.set_header("content-length", forged_body.len())
.set_header("content-type", "application/json;charset=utf-8");

View file

@ -7,7 +7,7 @@ use crate::debug;
// if it returns true, cancels the request
pub fn check_request(route: &str, body: &web::Bytes) -> bool {
match route {
"/apps/forms/api/v1/form/update" => rq_form_update(body),
"/ocs/v2.php/apps/forms/api/v1/form/update" => rq_form_update(body),
_ => false,
}
}