From a271dd5a8ca93c287dbf8341bd68b23c60c9a462 Mon Sep 17 00:00:00 2001 From: Roza Date: Sun, 28 Mar 2021 20:22:12 -0400 Subject: [PATCH] set body encodings for POST methods (because I forgot) --- binding/http-binding.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binding/http-binding.cpp b/binding/http-binding.cpp index df104e7f..a81d3a56 100644 --- a/binding/http-binding.cpp +++ b/binding/http-binding.cpp @@ -104,7 +104,7 @@ RB_METHOD(httpPost) { auto res = req.post(postData); ret = rb_hash_new(); rb_hash_aset(ret, ID2SYM(rb_intern("status")), INT2NUM(res.status())); - rb_hash_aset(ret, ID2SYM(rb_intern("body")), rb_utf8_str_new(res.body().c_str(), res.body().length())); + rb_hash_aset(ret, ID2SYM(rb_intern("body")), getResponseBody(res)); rb_hash_aset(ret, ID2SYM(rb_intern("headers")), stringMap2hash(res.headers())); } catch (Exception &e) { raiseRbExc(e); @@ -133,7 +133,7 @@ RB_METHOD(httpPostBody) { auto res = req.post(RSTRING_PTR(body), RSTRING_PTR(ctype)); ret = rb_hash_new(); rb_hash_aset(ret, ID2SYM(rb_intern("status")), INT2NUM(res.status())); - rb_hash_aset(ret, ID2SYM(rb_intern("body")), rb_utf8_str_new(res.body().c_str(), res.body().length())); + rb_hash_aset(ret, ID2SYM(rb_intern("body")), getResponseBody(res)); rb_hash_aset(ret, ID2SYM(rb_intern("headers")), stringMap2hash(res.headers())); } catch (Exception &e) { raiseRbExc(e);