diff options
| author | Zeyla Hellyer <[email protected]> | 2017-03-17 22:09:43 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-03-17 22:09:43 -0700 |
| commit | c6a45cb3afd0984756c0ef8757b63fd5d3964cb2 (patch) | |
| tree | 9a1ce125a52f53cb07b98f89881222941e50c9a6 /src | |
| parent | Fix no-cache compilations (diff) | |
| download | serenity-c6a45cb3afd0984756c0ef8757b63fd5d3964cb2.tar.xz serenity-c6a45cb3afd0984756c0ef8757b63fd5d3964cb2.zip | |
Fix rest::send_file
Remove usage of `Value::to_string` - which would encapsulate the
produced value with quotation marks - and instead match the type of
value and wwrite the text accordingly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/rest/mod.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/client/rest/mod.rs b/src/client/rest/mod.rs index 12a9a39..6b5b055 100644 --- a/src/client/rest/mod.rs +++ b/src/client/rest/mod.rs @@ -1467,7 +1467,14 @@ pub fn send_file<R: Read>(channel_id: u64, request.write_stream("file", &mut file, Some(filename), None)?; for (k, v) in map { - request.write_text(&k, v.to_string())?; + let _ = match v { + Value::Bool(false) => request.write_text(&k, "false")?, + Value::Bool(true) => request.write_text(&k, "true")?, + Value::I64(inner) => request.write_text(&k, inner.to_string())?, + Value::U64(inner) => request.write_text(&k, inner.to_string())?, + Value::String(inner) => request.write_text(&k, inner)?, + _ => continue, + }; } Message::decode(serde_json::from_reader(request.send()?)?) |