Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "Add JSONP support to the server"

This reverts commit b6bb31b.
  • Loading branch information...
commit 43f5eb9c540129a83ed946728e289e5160f2a0bd 1 parent d9cfb98
@erwaller erwaller authored
Showing with 5 additions and 10 deletions.
  1. +5 −10 lib/soulmate/server.rb
View
15 lib/soulmate/server.rb
@@ -6,14 +6,8 @@ module Soulmate
class Server < Sinatra::Base
include Helpers
- def handle_jsonp(data)
- if params[:callback]
- content_type 'text/javascript', :charset => 'utf-8'
- "#{params[:callback]}(#{data})"
- else
- content_type 'application/json', :charset => 'utf-8'
- data
- end
+ before do
+ content_type 'application/json', :charset => 'utf-8'
end
get '/' do
@@ -33,14 +27,15 @@ def handle_jsonp(data)
results[type] = matcher.matches_for_term(term, :limit => limit)
end
- handle_jsonp JSON.pretty_generate({
+ JSON.pretty_generate({
:term => params[:term],
:results => results
})
end
not_found do
- handle_jsonp JSON.pretty_generate({ :error => "not found" })
+ content_type 'application/json', :charset => 'utf-8'
+ JSON.pretty_generate({ :error => "not found" })
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.