Method: Agoo::Response#content=
- Defined in:
- ext/agoo/rresponse.c
#content=(val) ⇒ Object
call-seq: body=(str)
Sets the HTTP body for the response.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'ext/agoo/rresponse.c', line 96
static VALUE
body_set(VALUE self, VALUE val) {
agooResponse res = (agooResponse)DATA_PTR(self);
if (T_STRING == rb_type(val)) {
if (NULL == (res->body = AGOO_STRDUP(StringValuePtr(val)))) {
rb_raise(rb_eArgError, "failed to copy body");
}
res->blen = (int)RSTRING_LEN(val);
} else {
rb_raise(rb_eArgError, "Expected a string");
// TBD use Oj to encode val
}
return Qnil;
}
|