8000 Detect body parameter to implement #89 by clairernovotny · Pull Request #102 · reactiveui/refit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Detect body parameter to implement #89 #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 23, 2015

Conversation

clairernovotny
Copy link
Member

No description provided.

var ret = bodyParams[0];
return Tuple.Create(ret.BodyAttribute.SerializationMethod, parameterList.IndexOf(ret.Parameter));
}

if (bodyParams.Count == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this if anymore -- we've already checked > 1 and == 1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've already got a check for bodyParams.Count > 1 (line 429), then one for bodyParams.Count == 1 (line 434), and both of these throw or return if they are matched.

We don't need to check explicitly for bodyParams.Count == 0 on line 440, since it can't be anything else. (Unless I'm missing something - I am a little slow today 🍻)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I was the slow one and already fixed it; the PR is updated ☺

From: Bennor McCarthy [mailto:notifications@github.com]
Sent: Friday, December 19, 2014 6:08 PM
To: paulcbetts/refit
Cc: Oren Novotny
Subject: Re: [refit] Detect body parameter to implement #89 (#102)

In Refit/RequestBuilderImplementation.cshttps://github.com/paulcbetts/refit/pull/102#discussion-diff-22134905:

@@ -423,12 +430,32 @@ string getUrlNameForParameter(ParameterInfo paramInfo)

             throw new ArgumentException("Only one parameter can be a Body parameter");

         }
  •        // #1, body attribute wins
    
  •        if (bodyParams.Count == 1)
    
  •        {
    
  •            var ret = bodyParams[0];
    
  •            return Tuple.Create(ret.BodyAttribute.SerializationMethod, parameterList.IndexOf(ret.Parameter));
    
  •        }
    
         if (bodyParams.Count == 0) {

We've already got a check for bodyParams.Count > 1 (line 429), then one for bodyParams.Count == 1 (line 434), and both of these throw or return if they are matched.

We don't need to check explicitly for bodyParams.Count == 0 on line 440, since it can't be anything else. (Unless I'm missing something - I am a little slow today [:beers:] )


Reply to this email directly or view it on GitHubhttps://github.com/paulcbetts/refit/pull/102/files#r22134905.

@bennor
Copy link
Contributor
bennor commented Dec 19, 2014

Other than formatting and the redundant if, we'll need to document this behaviour - as it might be a breaking change for some people.

Other than that, it looks good to me.

@bennor
Copy link
Contributor
bennor commented Dec 19, 2014

Cool. Now just formatting :trollface: and a README update and it's good to go.

@clairernovotny
Copy link
Member Author

Once that ReSharper file is merged in, I can do a reformat with it...

@bennor
Copy link
Contributor
bennor commented Dec 19, 2014

Cool. Maybe we should give @paulcbetts a nudge on #105 - I'm not sure how cool he'd be with me merging my own PR without him at least looking at it.

@anaisbetts anaisbetts merged commit da4044a into reactiveui:master Aug 23, 2015
@clairernovotny clairernovotny deleted the detect-body-parameter branch August 31, 2015 03:12
@lock lock bot locked and limited conversation to collaborators Jun 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0