Class: Datadog::AppSec::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/appsec/response.rb

Overview

AppSec response

Constant Summary collapse

SECURITY_RESPONSE_ID_PLACEHOLDER =
'[security_response_id]'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, headers: {}, body: []) ⇒ Response

Returns a new instance of Response.



14
15
16
17
18
# File 'lib/datadog/appsec/response.rb', line 14

def initialize(status:, headers: {}, body: [])
  @status = status
  @headers = headers
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



12
13
14
# File 'lib/datadog/appsec/response.rb', line 12

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



12
13
14
# File 'lib/datadog/appsec/response.rb', line 12

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status.



12
13
14
# File 'lib/datadog/appsec/response.rb', line 12

def status
  @status
end

Class Method Details

.from_interrupt_params(interrupt_params, http_accept_header) ⇒ Object



25
26
27
28
29
# File 'lib/datadog/appsec/response.rb', line 25

def from_interrupt_params(interrupt_params, http_accept_header)
  return redirect_response(interrupt_params) if interrupt_params['location']

  block_response(interrupt_params, http_accept_header)
end

Instance Method Details

#to_rackObject



20
21
22
# File 'lib/datadog/appsec/response.rb', line 20

def to_rack
  [status, headers, body]
end