Skip to content
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

Allow all headers to be set as Response headers #142

Merged
merged 6 commits into from
May 25, 2018

Conversation

StefH
Copy link
Collaborator

@StefH StefH commented May 19, 2018

Related to:

#137
#136
#126

@StefH StefH requested a review from alastairtree May 20, 2018 09:19
@codecov
Copy link

codecov bot commented May 20, 2018

Codecov Report

Merging #142 into master will decrease coverage by 0.08%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #142      +/-   ##
==========================================
- Coverage   67.87%   67.79%   -0.09%     
==========================================
  Files          80       80              
  Lines        2945     2931      -14     
  Branches      394      394              
==========================================
- Hits         1999     1987      -12     
+ Misses        730      727       -3     
- Partials      216      217       +1
Impacted Files Coverage Δ
src/WireMock.Net/Server/FluentMockServer.cs 50.41% <ø> (ø) ⬆️
src/WireMock.Net/Owin/OwinResponseMapper.cs 89.13% <85.71%> (-0.71%) ⬇️
src/WireMock.Net/Server/FluentMockServer.Admin.cs 40.03% <0%> (+0.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 538d04e...e4ff8a6. Read the comment docs.

@StefH
Copy link
Collaborator Author

StefH commented May 23, 2018

@alastairtree can you review this pr?

@alastairtree
Copy link
Collaborator

alastairtree commented May 24, 2018

I'm not sure I understand the motivation for this change or the original header restriction? Any background?

@StefH
Copy link
Collaborator Author

StefH commented May 25, 2018

Related to:

#137
#136
#126

_serverForProxyForwarding = FluentMockServer.Start();
// Assign
var settings = new FluentMockServerSettings { AllowPartialMapping = false };
_serverForProxyForwarding = FluentMockServer.Start(settings);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps names these 2 servers more specifically as it is quite hard to follow. _serverThatReturnsRedirects and serverThatProxies ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I understand your comment, however for me it's clear for now. But I will think about this to see if I want to rename the these variables.

_serverForProxyForwarding = FluentMockServer.Start();
// Assign
var settings = new FluentMockServerSettings { AllowPartialMapping = false };
_serverForProxyForwarding = FluentMockServer.Start(settings);
_serverForProxyForwarding
.Given(Request.Create().WithPath("/*"))
.RespondWith(Response.Create()
.WithStatusCode(HttpStatusCode.Redirect)
.WithHeader("Location", _serverForProxyForwarding.Urls[0] + "testpath"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

This creates a server that could redirect indefinitely I think. Request.Create().WithPath("/") instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it has to be like this, else test fails.

@@ -364,24 +367,25 @@ public void FluentMockServer_Admin_Mappings_Add_SameGuid()
new object[] { new JsonPathMatcher("$..[?(@.message == 'Hello server')]"), "text/plain" }
};

[Theory]
Copy link
Collaborator

@alastairtree alastairtree May 25, 2018

Choose a reason for hiding this comment

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

Any particular reason for not using the parameterised tests? The test cleanup at the end could also be done by making the class IDisposable if preferred.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For some reason the tests failed on my local machine, so I just fixed it this way.

Copy link
Collaborator

@alastairtree alastairtree left a comment

Choose a reason for hiding this comment

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

Added a couple of minor comments

@StefH
Copy link
Collaborator Author

StefH commented May 25, 2018

Thanks a lot!

@StefH StefH merged commit eda71bd into master May 25, 2018
@StefH StefH deleted the stef_136_Content-Length branch May 25, 2018 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants