changes string marcher for precise version match #30

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@gouthamvel

orig: "v1.1".include?("v1") => true
mod: "v1.1".eql?("v1") => false

orig was causing the wrong version to load. The mod fixes it.

@gouthamvel gouthamvel changes string marcher for precise version match
"v1.1".include?("v1") => true
"v1.1".eql?("v1") => false
4f824b0
@bploetz
Owner
bploetz commented Dec 4, 2012

This is using include? for a reason. Consider the following Accept header:

Accept: application/vnd.mycompany.com; version=1,application/json

If the header contains other things in addition to the version string, eql? will never return true.

But your larger point is valid in that the current logic will find false positives. I'll gladly accept a pull request that fixes this in a way that correctly deals with multiple things being in the Accept header (and of course includes supporting tests). Otherwise, I'll try to include a fix for this in the upcoming 1.0 release.

@gouthamvel gouthamvel added a commit to gouthamvel/versionist that referenced this pull request Jan 14, 2013
@gouthamvel gouthamvel resolves issue #30
orig: "v1.1".include?("v1") => true
mod: "v1.1".eql?("v1") => false

orig was causing the wrong version to load. The mod fixes it. Works
with Accept header, custom header, defaults.
e7c8240
@gouthamvel gouthamvel closed this Jan 14, 2013
@bploetz bploetz pushed a commit that referenced this pull request Jan 21, 2013
Brian Ploetz Issue #30 and Issue #31: Header strategy false positives in matches? f56b25f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment