Sha256: 9650069eafb26fc12bfb7484d9a931af6c1ff901758ea7bc7fead5963c0cadef
Contents?: true
Size: 957 Bytes
Versions: 23
Compression:
Stored size: 957 Bytes
Contents
# frozen_string_literal: true 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 @headers['Content-Type'] = @body.content_type if @headers['Content-Type'].nil? 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
23 entries across 23 versions & 1 rubygems