Skip to content
Advertisement

Rust: View entire Command::New command arguement structs as its passed to terminal / correct my arguements

I am not getting the correct response from the server running the following

JavaScript

However…. the following works fine if I run it in terminal. I form the following using let line = "curl -X POST --header "Authorization: Bearer ".to_owned() + &return_token("auth") + "" --header "Content-Type: application/json" -d " + parameters + " "https://api.tdameritrade.com/v1/accounts/CORRECT_ACCOUNT_#/orders"";

JavaScript

“parameters” can be seen above in JSON.

How can do I view the formation of the command that Command::New is making or correct my args?

EDIT Ive tried using a single quote around the JSON and not escaping the double quotes, which also works in the terminal.

EDIT Example included. I found this : https://github.com/rust-lang/rust/issues/29494 && https://users.rust-lang.org/t/std-process-is-escaping-a-raw-string-literal-when-i-dont-want-it-to/19441/14

However Im in linux…

JavaScript

Advertisement

Answer

For reasons unknown… changing the –header switch / flag to -H solved the problem. As shown in the following. Spoke with a friend and apparently the shortened form may take different parameters.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement