Skip to content

Detect body parameter to implement #89 - #102

Merged
anaisbetts merged 8 commits into
reactiveui:masterfrom
clairernovotny:detect-body-parameter
Aug 23, 2015
Merged

anaisbetts merged 8 commits into
reactiveui:masterfrom
clairernovotny:detect-body-parameter

Conversation

@clairernovotny

Copy link
Copy Markdown
Member

No description provided.

Comment thread Refit/RequestBuilderImplementation.cs Outdated

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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:[email protected]]
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

bennor commented Dec 19, 2014

Copy link
Copy Markdown
Contributor

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

bennor commented Dec 19, 2014

Copy link
Copy Markdown
Contributor

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

@clairernovotny

Copy link
Copy Markdown
Member Author

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

@bennor

bennor commented Dec 19, 2014

Copy link
Copy Markdown
Contributor

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