Class: RackOnLambda::Adapters::Responses::RestApiResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/rack_on_lambda/adapters/responses/rest_api_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(status, headers, body) ⇒ RestApiResponse

Returns a new instance of RestApiResponse.



7
8
9
10
11
# File 'lib/rack_on_lambda/adapters/responses/rest_api_response.rb', line 7

def initialize(status, headers, body)
  @status = status
  @headers = headers
  @body = stringify_body(body)
end

Instance Method Details

#as_json(_options = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/rack_on_lambda/adapters/responses/rest_api_response.rb', line 13

def as_json(_options = {})
  {
    'statusCode' => status,
    'headers' => headers,
    'isBase64Encoded' => base64_encoded?,
    'body' => body
  }
end