class FDK::HTTPContext

Represents the context data (inbound && outbound) for the execution passed as HTTP headers

Attributes

headers[R]
response_headers[R]

Public Class Methods

new(ctx) click to toggle source
# File lib/fdk/context.rb, line 129
def initialize(ctx)
  fn_http_h_ = "fn-http-h-"
  @ctx = ctx
  http_headers = {}
  ctx.headers.each do |k, v|
    http_headers[k.sub(fn_http_h_, "")] = v if k.downcase.start_with?(fn_http_h_)
  end
  @headers = InHeaders.new(http_headers, nil)
  @response_headers = OutHeaders.new(ctx.response_headers, ->(s) { fn_http_h_ + s })
end

Public Instance Methods

method() click to toggle source
# File lib/fdk/context.rb, line 144
def method
  @ctx.headers["fn-http-method"]
end
request_url() click to toggle source
# File lib/fdk/context.rb, line 140
def request_url
  @ctx.headers["fn-http-request-url"]
end
status_code=(val) click to toggle source
# File lib/fdk/context.rb, line 148
def status_code=(val)
  @ctx.response_headers["fn-http-status"] = val.to_i
end