Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Commit

Permalink
multi-parameter 'value' (side-steps rack)
Browse files Browse the repository at this point in the history
rack does not parse same-key parameters to an array so the
env["QUERY_STRING"] value (from rack) is parsed directly

rack/rack#519

400 returned if value is not present (value+ required)
  • Loading branch information
abargnesi committed May 22, 2014
1 parent eb32696 commit c069f43
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api-namespaces/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require 'sinatra/config_file'
require 'sinatra/reloader'
require 'json'
require 'cgi'
require_relative 'lib/openbel'

class Namespaces < Sinatra::Base
Expand Down Expand Up @@ -53,8 +54,8 @@ def initialize
end

get '/namespaces/:namespace/equivalents/?' do |namespace|
values = request.params['values'].split(',')
halt 404 unless values and not values.empty?
halt 400 unless request.params['value']
values = CGI::parse(env["QUERY_STRING"])['value']

options = {}
if request.params['namespace']
Expand Down

0 comments on commit c069f43

Please sign in to comment.