Skip to content

Instantly share code, notes, and snippets.

@ozydingo
Created March 27, 2019 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozydingo/9a1c8642f5ef9570746ff2bf4772ad96 to your computer and use it in GitHub Desktop.
Save ozydingo/9a1c8642f5ef9570746ff2bf4772ad96 to your computer and use it in GitHub Desktop.
Rails controller to see your request
class InpsectionsController < ApplicationController
def index
log
head :ok
end
def create
log
head :ok
end
private
def log
Rails.logger.info("===============")
Rails.logger.info("Raw post:")
Rails.logger.info("---------------")
Rails.logger.info(request.raw_post)
Rails.logger.info("---------------")
Rails.logger.info("Method: #{request.method}")
Rails.logger.info("Format: #{request.format}")
Rails.logger.info("Content type: #{request.content_type}")
Rails.logger.info("Params: #{params}")
Rails.logger.info("Request params: #{request.request_parameters}")
Rails.logger.info("Query params: #{request.query_parameters}")
Rails.logger.info("Body: #{request.body.read rescue request.body}")
Rails.logger.info("===============")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment