* Fixed issue where put requests weren't firing with the optional body parameter
This also "fixes" the /neighbor/update route conveniently enough, which had much better behavior than expected before. - Remvoing some fluff from debugging
This commit is contained in:
parent
a0d60c0568
commit
8bff61ab71
@ -41,7 +41,7 @@ class Request:
|
|||||||
elif self.method == 'delete':
|
elif self.method == 'delete':
|
||||||
self.response = requests.delete(self.url, headers=self.headers, params=self.qs)
|
self.response = requests.delete(self.url, headers=self.headers, params=self.qs)
|
||||||
elif self.method == 'put':
|
elif self.method == 'put':
|
||||||
self.response = requests.put(self.url, headers=self.headers, params=self.qs)
|
self.response = requests.put(self.url, headers=self.headers, params=self.qs, data=self.body)
|
||||||
|
|
||||||
return self.response
|
return self.response
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -7,7 +7,6 @@ use serde_json::json;
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::http::set_json_body;
|
use crate::http::set_json_body;
|
||||||
use crate::perms;
|
|
||||||
use crate::qs_param;
|
use crate::qs_param;
|
||||||
use db::Message;
|
use db::Message;
|
||||||
|
|
||||||
|
@ -101,8 +101,6 @@ pub async fn update_neighbor(p: &Pool, response: &mut Response<Body>, params: Ha
|
|||||||
let s: String = String::from_utf8_lossy(&body).to_string();
|
let s: String = String::from_utf8_lossy(&body).to_string();
|
||||||
let json: JsonResult<Neighbor> = serde_json::from_str(&s);
|
let json: JsonResult<Neighbor> = serde_json::from_str(&s);
|
||||||
|
|
||||||
println!("\tjson result: {:?}", json);
|
|
||||||
println!("\tbody {}", s);
|
|
||||||
// Verify query string parameter **and** body before attempting to reach database
|
// Verify query string parameter **and** body before attempting to reach database
|
||||||
match (target, json) {
|
match (target, json) {
|
||||||
(Some(target_url), Ok(neighbor)) => {
|
(Some(target_url), Ok(neighbor)) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user