mirror of https://git.42l.fr/neil/sncf.git
moving to forms OCSv2 API
This commit is contained in:
parent
9f304c4069
commit
abd6c91013
|
@ -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");
|
||||
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue