class Ritm::ParamEncoder

Forwarder that acts as a WEBrick <-> Faraday adaptor: Works this way:

1. A WEBrick request objects is received
2. The WEBrick request object is sent to the request interceptor
3. The (maybe modified) WEBrick request object is transformed into a Faraday request and sent to destination server
4. The Faraday response obtained from the server is transformed into a WEBrick response
5. The WEBrick response object is sent to the response interceptor
6. The (maybe modified) WEBrick response object is sent back to the client

Besides the possible modifications to be done by interceptors there might be automated globally configured transformations like header stripping/adding.

Public Instance Methods

decode(query) click to toggle source
# File lib/ritm/interception/http_forwarder.rb, line 23
def decode(query)
  query.split('&').each_with_object({}) do |param, params|
    k, v = param.split('=')
    params[k] = v
  end
end
encode(params) click to toggle source
# File lib/ritm/interception/http_forwarder.rb, line 18
def encode(params)
  pairs = params.map { |k, v| "#{k}=#{v}" }
  pairs.join('&')
end