lib/flexirest/request.rb in flexirest-1.8.6 vs lib/flexirest/request.rb in flexirest-1.8.7

- old
+ new

@@ -351,10 +351,11 @@ end end end def prepare_url + missing = [] if @forced_url && @forced_url.present? @url = @forced_url else @url = @method[:url].dup matches = @url.scan(/(:[a-z_-]+)/) @@ -366,11 +367,18 @@ target = @get_params.delete(token.to_sym) || @post_params.delete(token.to_sym) || @get_params.delete(token.to_s) || @post_params.delete(token.to_s) || "" unless object_is_class? # it's possible the URL path variable may not be part of the request, in that case, try to resolve it from the object attributes target = @object._attributes[token.to_sym] || "" if target == "" end + if target.to_s.blank? + missing << token + end @url.gsub!(":#{token}", URI.escape(target.to_s).gsub("/", "%2F").gsub("+", "%2B")) end + end + + if missing.present? + raise Flexirest::MissingParametersException.new("The following parameters weren't specifed: #{missing.join(", ")}") end end def append_get_parameters if @get_params.any?