Sha256: 9288700183e3c37fcf20aaa68033a93305aa9ccfe851ef6358796c8b15d4298d
Contents?: true
Size: 954 Bytes
Versions: 26
Compression:
Stored size: 954 Bytes
Contents
module Praxis module Responses class MultipartOk < Ok def initialize(status:self.class.status, headers:{}, body:'') @name = response_name @status = status @headers = headers @body = body end def handle case @body when Praxis::Types::MultipartArray if @headers['Content-Type'].nil? @headers['Content-Type'] = @body.content_type end end end def encode! case @body when Praxis::Types::MultipartArray @body = @body.dump else super end end def finish format! encode! @body = Array(@body) [@status, @headers, @body] end end end ApiDefinition.define do |api| api.response_template :multipart_ok do |media_type: Praxis::Types::MultipartArray| status 200 media_type media_type end end end
Version data entries
26 entries across 26 versions & 1 rubygems