Api gateway#60 - #83
Open
guysa-AMG wants to merge 6 commits into
Open
Conversation
Owner
|
@guysa-AMG thanks for all the efforts, I will make you a PR as |
Author
|
morning .i have refactored the method names to lowercase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #60
This pull request adds a set of helper functions that handle REST API requests using the native fetch API. Each function supports both JSON and text responses and includes callbacks for handling success, errors, and cleanup.
The methods implemented are:
Get – performs GET requests and returns parsed data.
Post – sends POST requests with headers and body.
Put – updates resources using PUT requests.
Patch – partially updates resources.
Delete – deletes resources.
Each function consistently uses handlerCallback, errorCallback, and finalCallback to give full control over response handling and error management.
Unit tests were written using Jest. The tests rely on mocked responses to simulate different outcomes, including success and error cases. These tests confirm that each method behaves as expected, properly resolves data, and triggers the right callbacks.