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

Add extra capabilities for on request handling #139

Merged
merged 2 commits into from
Nov 7, 2022

Conversation

AvdLee
Copy link
Contributor

@AvdLee AvdLee commented Nov 4, 2022

During updating our internal projects to the latest major release of Mocker it turned out that the on-request handler could be improved with a few common scenarios. We now offer callbacks for:

  • Empty on request handlers, no interest in request or body arguments
  • Top-level collection body arguments
  • JSON Dictionary body arguments
  • Decodable body arguments
  • URLRequest-only containing callback

I'm convinced this will level up the possibilities our framework offers to all our users.
Secondly, we didn't test all scenarios, so I added a few more to increase coverage.

@wetransferplatform
Copy link
Collaborator

wetransferplatform commented Nov 4, 2022

Warnings
⚠️

'onRequest' is deprecated: Use onRequestHandler instead.

⚠️

'onRequest' is deprecated: Use onRequestHandler instead.

Messages
📖

View more details on Bitrise

📖 MockerTests: Executed 30 tests (0 failed, 0 retried, 0 skipped) in 1.778 seconds

SwiftLint found issues

Severity File Reason
Warning OnRequestHandler.swift:47 Line should be 140 characters or less: currently 149 characters (line_length)
Error OnRequestHandler.swift:57 Line should be 160 characters or less: currently 168 characters (line_length)
Error OnRequestHandler.swift:73 Line should be 160 characters or less: currently 163 characters (line_length)
Warning Mock.swift:87 Computed properties should declare first the getter and then the setter. (computed_accessors_order)
Error Mock.swift:8 Line should be 160 characters or less: currently 177 characters (line_length)
Warning Mock.swift:49 Line should be 140 characters or less: currently 155 characters (line_length)
Error Mock.swift:81 Line should be 160 characters or less: currently 211 characters (line_length)
Error Mock.swift:84 Line should be 160 characters or less: currently 208 characters (line_length)
Error Mock.swift:95 Line should be 160 characters or less: currently 217 characters (line_length)
Error Mock.swift:104 Line should be 160 characters or less: currently 287 characters (line_length)
Warning Mock.swift:133 Line should be 140 characters or less: currently 142 characters (line_length)
Warning Mock.swift:140 Line should be 140 characters or less: currently 141 characters (line_length)
Error Mock.swift:147 Line should be 160 characters or less: currently 246 characters (line_length)
Error Mock.swift:148 Line should be 160 characters or less: currently 236 characters (line_length)
Warning Mock.swift:159 Line should be 140 characters or less: currently 150 characters (line_length)
Warning Mock.swift:160 Line should be 140 characters or less: currently 153 characters (line_length)
Warning Mock.swift:196 Line should be 140 characters or less: currently 159 characters (line_length)
Error Mock.swift:206 Line should be 160 characters or less: currently 168 characters (line_length)
Warning MockerTests.swift:163 Line should be 140 characters or less: currently 151 characters (line_length)
Warning MockerTests.swift:181 Line should be 140 characters or less: currently 149 characters (line_length)
Warning MockerTests.swift:239 Line should be 140 characters or less: currently 154 characters (line_length)
Warning MockerTests.swift:52 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:71 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:94 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:116 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:149 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:165 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:183 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:206 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:259 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:520 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning MockerTests.swift:554 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)

Code Coverage Report

Name Coverage
Mocker 88.59%

Generated by 🚫 Danger Swift against b0d713e

@AvdLee AvdLee requested a review from neodym November 7, 2022 08:37
Copy link
Contributor

@BasThomas BasThomas left a comment

Choose a reason for hiding this comment

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

Is this breaking change expected after already having released a v3?

Sources/Mocker/OnRequestHandler.swift Show resolved Hide resolved
@AvdLee AvdLee requested a review from BasThomas November 7, 2022 14:24
@AvdLee AvdLee merged commit c009626 into master Nov 7, 2022
@AvdLee AvdLee deleted the feature/enhanced-onrequest-handling branch November 7, 2022 15:48
@wetransferplatform
Copy link
Collaborator

Congratulations! 🎉 This was released as part of Release 3.0.1 🚀

Generated by GitBuddy

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

4 participants