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

feat(server): match the most specific httprequest 💎 #116

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

alex-held
Copy link
Owner

No description provided.

@commit-lint
Copy link

commit-lint bot commented Feb 1, 2020

Code Refactoring

  • server: each matched header increments the evaluation score by one (adbbb7d)
  • server: sort incoming matched request based on setup granularity 💎 (e61fb3a)

Contributors

@alex-held

@alex-held alex-held self-assigned this Feb 1, 2020
@alex-held alex-held added this to the mock-server milestone Feb 1, 2020
@alex-held
Copy link
Owner Author

Codacy Here is an overview of what got changed by this pull request:

Issues
======
- Added 2
           

Complexity increasing per file
==============================
- src/NinjaTools.FluentMockServer.API/Infrastructure/RequestRepository.cs  1
- src/NinjaTools.FluentMockServer.API/Models/Cookies.cs  1
- src/NinjaTools.FluentMockServer.API/Models/RequestMatcher.cs  7
- src/NinjaTools.FluentMockServer.API/Infrastructure/ISetupRepository.cs  1
- src/NinjaTools.FluentMockServer.API/Models/HttpResponse.cs  4
- src/NinjaTools.FluentMockServer.API/Models/Setup.cs  3
- src/NinjaTools.FluentMockServer.API/Proxy/Visitors/RequestMatcherEvaluationVisitor.cs  10
- src/NinjaTools.FluentMockServer.API/Models/Query.cs  2
- src/NinjaTools.FluentMockServer.API/Models/RequestBodyMatcher.cs  2
- src/NinjaTools.FluentMockServer.API/Models/Headers.cs  2
- src/NinjaTools.FluentMockServer.API/Infrastructure/SetupRepository.cs  1
- src/NinjaTools.FluentMockServer.API/Models/Method.cs  2
- src/NinjaTools.FluentMockServer.API/Models/ResponseAction.cs  2
- test/NinjaTools.FluentMockServer.API.Tests/Infrastructure/SetupRepositoryTests.cs  3
- src/NinjaTools.FluentMockServer.API/Models/Path.cs  2
         

Complexity decreasing per file
==============================
+ src/NinjaTools.FluentMockServer.API/Proxy/Visitors/IVisitor.cs  -1
         

Clones added
============
- src/NinjaTools.FluentMockServer.API/Models/Cookies.cs  2
- src/NinjaTools.FluentMockServer.API/Models/RequestMatcher.cs  2
- src/NinjaTools.FluentMockServer.API/Models/HttpResponse.cs  1
- src/NinjaTools.FluentMockServer.API/Models/Setup.cs  3
- src/NinjaTools.FluentMockServer.API/Models/Query.cs  2
- src/NinjaTools.FluentMockServer.API/Models/RequestBodyMatcher.cs  2
- src/NinjaTools.FluentMockServer.API/Models/Headers.cs  2
- src/NinjaTools.FluentMockServer.API/Models/Method.cs  2
- src/NinjaTools.FluentMockServer.API/Models/ResponseAction.cs  2
- src/NinjaTools.FluentMockServer.API/Models/Path.cs  2
         

Clones removed
==============
+ test/NinjaTools.FluentMockServer.API.Tests/Proxy/ComparasionVisitorTests.cs  -2
         

See the complete overview on Codacy

HttpRequest.Body.Seek(0, SeekOrigin.Begin);
using var reader = new StreamReader(HttpRequest.Body);
var httpBody = reader.ReadToEnd();
Guard.Against.NullOrEmpty(visitable.Cookie, nameof(visitable) + nameof(Cookies));
Copy link
Owner Author

Choose a reason for hiding this comment

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

public sealed class ComparasionVisitor : IVisitor,
IVisitor<RequestMatcher>,
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + "}")]
public sealed class RequestMatcherEvaluationVisitor :
Copy link
Owner Author

Choose a reason for hiding this comment

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

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 1, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant