def call(env)
      env = Rack::Utils::HeaderHash.new(env)

      if transform_request?(env)
        env[ENV_PAYLOAD_KEY] = Oj.load(env[ENV_RACK_INPUT_KEY])
      end

      status, headers, body = @app.call(env)
      headers = Rack::Utils::HeaderHash.new(headers)

      if transform_response?(headers, body)
        body = Oj.dump(body) unless body.is_a?(String)
        headers[CONTENT_LENGTH_KEY] = body.length.to_s
        body = [body] unless body.respond_to?(:each)
      end

      [status, headers, body]
    end
def call(env)
      env = Rack::Utils::HeaderHash.new(env)

      if transform_request?(env)
        env[ENV_PAYLOAD_KEY] = Oj.load(env[ENV_RACK_INPUT_KEY])
      end

      status, headers, body = @app.call(env)
      headers = Rack::Utils::HeaderHash.new(headers)

      if transform_response?(headers, body)
        body = Oj.dump(body) unless body.is_a?(String)
        headers[CONTENT_LENGTH_KEY] = body.length.to_s
        body = [body] unless body.respond_to?(:each)
      end

      [status, headers, body]
    end
Called via the rack `use` method. Used to register the middleware and
 optionally toggle request and response processing of JSON to Object.
 By default both the request and response is processed and transformed.
 Loads the request JSON string into a Hash instance.
 Expects the app response body to be an object e.g. Hash,
 putting the object in an array will likely cause unexpected JSON.
 If the response body is processed then the `Content-Length` header will
 be set to the body#length.