Skip to content

Network request helper parity#414

Merged
timkimadobe merged 5 commits intoadobe:devfrom
timkimadobe:network-request-helper-parity
Oct 2, 2023
Merged

Network request helper parity#414
timkimadobe merged 5 commits intoadobe:devfrom
timkimadobe:network-request-helper-parity

Conversation

@timkimadobe
Copy link
Copy Markdown
Contributor

Description

This PR refactors the NetworkRequestHelper's networkResponses data struct to use a 1:many relationship between network requests and responses. This is to support more complex use cases that would rely on multiple requests to the same endpoint.

Before After
[TestableNetworkRequest: HttpConnection] [TestableNetworkRequest: [HttpConnection]]

Also adds a new method in the NetworkRequestHelper:
removeAllResponses(for networkRequest: NetworkRequest)
Which allows the MockNetworkRequest to maintain the 1:1 network request to response behavior via its own methods to set mock network responses.

Question for reviewers

  1. Please let me know if, for the new method removeAllResponses(for:):
    1. Method/parameter name makes sense
    2. Method is required to maintain MockNetworkService's API contract to set 1:1 network request to mock response

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@timkimadobe timkimadobe requested review from addb, cacheung, emdobrin and kevinlind and removed request for emdobrin September 29, 2023 22:37
@codecov
Copy link
Copy Markdown

codecov bot commented Sep 29, 2023

Codecov Report

Merging #414 (bb6eb1d) into dev (2053d90) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##              dev     #414   +/-   ##
=======================================
  Coverage   96.77%   96.77%           
=======================================
  Files          27       27           
  Lines        1671     1671           
=======================================
  Hits         1617     1617           
  Misses         54       54           

@timkimadobe timkimadobe merged commit acd714e into adobe:dev Oct 2, 2023
@timkimadobe timkimadobe deleted the network-request-helper-parity branch October 2, 2023 22:02
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.

2 participants