-
Notifications
You must be signed in to change notification settings - Fork 6
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/module-http/validate-request-init #2491
Merged
Merged
Conversation
This file contains 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
🦋 Changeset detectedLatest commit: 49b89df The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
github-actions
bot
added
📚 documentation
Improvements or additions to documentation
🚀 feature
New feature or request
🚧 chore
maintaines work, (update deps, workflos ...)
🧬 Modules
👾 React
labels
Oct 1, 2024
Add a new operator `capitalizeRequestMethodOperator` to ensure that the `RequestInit` method of a given request is in uppercase.
Add a new feature to the `@equinor/fusion-framework-module-http` package. This feature introduces the `requestValidationOperator`, a utility function that validates incoming requests against a Zod schema. The function has options for strict validation and parsing of the request object. This operator is meant to be used as a request operator in the Fusion API framework.
…ValidationOperator by default
added zod
…low handle errors silently
odinr
force-pushed
the
feat/module-http/validate-request-init
branch
from
October 2, 2024 05:08
da9124e
to
49b89df
Compare
jaysencpp
approved these changes
Oct 2, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🚧 chore
maintaines work, (update deps, workflos ...)
📚 documentation
Improvements or additions to documentation
🚀 feature
New feature or request
🧬 Modules
👾 React
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.
Why
After moving services to the Azure Cluster with Nginx, it was discovered that some HTTP requests did not have uppercase verbs in the request
method
, leading to invalid requests.Description
This pull request introduces several enhancements and new features to the
@equinor/fusion-framework-module-http
package. Below are the details of the changes:Changes
New Operator:
capitalizeRequestMethodOperator
Default Operators in
HttpClientConfigurator
HttpClientConfigurator
now hascapitalizeRequestMethodOperator
andrequestValidationOperator
enabled by default.New Operator:
requestValidationOperator
strict
andparse
.New Method: [
remove
] inProcessOperators
Refactor
Altered HTTP request verbs to uppercase in the following packages:
@equinor/fusion-framework-legacy-interopt
@equinor/fusion-framework-module-services
Tests
capitalizeRequestMethodOperator Tests:
Test 1: Ensures that the request method is capitalized (e.g., 'get' becomes 'GET'). It also checks that a warning message related to RFC 7231 is logged to the console.
requestValidationOperator Tests:
Test 1: Validates that a request with valid parameters passes without errors.
Test 2: Ensures that a request with valid parameters is correctly parsed and returned as-is.
Test 3: Checks that additional properties are allowed when strict validation is disabled.
Test 4: Ensures that additional properties are removed when strict validation is enabled.
Test 5: Verifies that an error is thrown for requests with invalid parameters (e.g., an invalid HTTP method).
Checklist