Skip to content

Built framework for processing different parameter types based on request method #124

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

Merged
merged 5 commits into from
Jun 21, 2022

Conversation

corymharper
Copy link
Contributor

In this merge request I prepared for having multiple parameter data types in resolving #115, to accomplish that i changed the way the URL was being built for GET requests to just be a static base for every kind of request, and append URL parameters if its a GET request. In connection, I modified buildRequestURL to just return the search parameters as a string, instead of the whole URL. Lastly I made a new function, processParameters that is meant to be the single source for logic dedicated to processing parameters for every kind of request.

@codecov
Copy link

codecov bot commented Jun 18, 2022

Codecov Report

Merging #124 (e4f5f62) into master (3f94eb7) will increase coverage by 0.10%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #124      +/-   ##
==========================================
+ Coverage   97.85%   97.95%   +0.10%     
==========================================
  Files           9       10       +1     
  Lines         140      147       +7     
  Branches       41       44       +3     
==========================================
+ Hits          137      144       +7     
  Misses          3        3              
Impacted Files Coverage Δ
src/retrieve-validation/browser.ts 95.23% <100.00%> (ø)
...etrieve-validation/build-request-url-parameters.ts 100.00% <100.00%> (ø)
src/retrieve-validation/index.ts 100.00% <100.00%> (ø)
src/retrieve-validation/node.ts 92.85% <100.00%> (+0.26%) ⬆️
src/retrieve-validation/process-parameters.ts 100.00% <100.00%> (ø)

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 3f94eb7...e4f5f62. Read the comment docs.

Copy link
Member

@WesCossick WesCossick left a comment

Choose a reason for hiding this comment

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

See comments above.

@WesCossick
Copy link
Member

Can you describe how POST requests will eventually interact with this code?

Co-authored-by: Wes Cossick <WesCossick@users.noreply.github.com>
@corymharper
Copy link
Contributor Author

Can you describe how POST requests will eventually interact with this code?

const processParameters = (method: Parameters<typeof retrieveValidation>[0], parameters: RequestParameters): string => {
	// Handle parameters for GET method
	...

	// Handle parameters for POST method
	if (method === 'POST') {
	    // Build and return parameters object for the body here
	}

	...
};

That returned parameters object will be passed in the same way the search parameters are being passed in now for the GET request.

@WesCossick WesCossick merged commit 9250b2a into master Jun 21, 2022
@WesCossick WesCossick deleted the prepare-for-multiple-parameter-types branch June 21, 2022 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants