Sha256: 27e89a2b6428b0a2fe55b1e82e93488a57fea1a1429b9eb5df79d0595f489e14
Contents?: true
Size: 815 Bytes
Versions: 2
Compression:
Stored size: 815 Bytes
Contents
# *Flexirest:* Empty body handling If you call a RESTful method that correctly returns a 204 when the request was accepted, but no body is supplied, Flexirest will return `true`. If you call this on an instance of a Flexirest subclass, it will not affect the existing attributes. ```ruby class Person < Flexirest::Base put :save, "/people/:id" end p = Person.new(id: "1", name: "Jenny") saved = p.save puts saved === true # true puts p.name # Jenny ``` If your API returns a 200 OK status with an empty body, by default this is handled in the normal way - the attributes are set to an empty set. If you intend to handle it as above for the 204, you can set an extra option on the mapped method like this: ```ruby class Person < Flexirest::Base put :save, "/people/:id", ignore_empty_response: true end ```
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flexirest-1.10.10 | docs/empty-body-handling.md |
flexirest-1.10.9 | docs/empty-body-handling.md |