Skip to content

Instantly share code, notes, and snippets.

@shunirr
Created April 8, 2016 03:30
Show Gist options
  • Select an option

  • Save shunirr/2a2c9a3403893ebabbe23114db4fd345 to your computer and use it in GitHub Desktop.

Select an option

Save shunirr/2a2c9a3403893ebabbe23114db4fd345 to your computer and use it in GitHub Desktop.

Revisions

  1. shunirr renamed this gist Apr 8, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. shunirr created this gist Apr 8, 2016.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    require 'sinatra'
    require 'httpclient'

    CALLBACK_URI = URI.parse('http://example.com/callback')

    configure do
    set :httpclient, HTTPClient.new
    end

    post '/callback' do
    settings.httpclient.post_async(
    CALLBACK_URI,
    request.body.read,
    {
    'Content-Type' => 'application/json; charset=UTF-8',
    'X-LINE-ChannelSignature' => request.env['X-LINE-ChannelSignature']
    })
    200
    end