Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Revert "Add JSONP support to the server"
Browse files Browse the repository at this point in the history
This reverts commit b6bb31b.
  • Loading branch information
erwaller committed May 10, 2011
1 parent d9cfb98 commit 43f5eb9
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/soulmate/server.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 43f5eb9

Please sign in to comment.