-
Notifications
You must be signed in to change notification settings - Fork 350
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 option to make Content-ID header optional #2713
base: release-7.x
Are you sure you want to change the base?
Add option to make Content-ID header optional #2713
Conversation
} | ||
else | ||
{ | ||
this.currentContentId = Guid.NewGuid().ToString(); |
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.
Is it better to change the type of 'CurrentContentId' to System.Guid?
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.
currentContentId is an arbitrary value of user-provided header. I assign it to guid just for specific case
@@ -235,6 +236,12 @@ public ODataMessageQuotas MessageQuotas | |||
/// </summary> | |||
internal bool ThrowOnUndeclaredPropertyForNonOpenType { get; private set; } | |||
|
|||
/// <summary> | |||
/// Require Content-Id header in changesets | |||
/// If turned off allows to read OData 2.0 requests without Content-Id header present. |
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.
What do you mean about "OData 2.0" ? It's a OData spec version number?
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.
Yeah
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.
@xuzhg @mikepizzo Do we really still support pre 4.0 versions on ODL 7.x?
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.
To be precise this small addition not to support 4.0 metadata, just for reading requests
[Fact] | ||
public void ReadMultipartMixedBatchRequestWthoutContentId() | ||
{ | ||
var payload = Regex.Replace(batchRequestPayload, "Content-ID: .", ""); |
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.
we can't use the String.Replace to replace it?
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.
Because I want to remove all Content-ID headers, not just one (in regex symbol . means any symbol)
src/Microsoft.OData.Core/MultipartMixed/ODataMultipartMixedBatchReader.cs
Show resolved
Hide resolved
src/Microsoft.OData.Core/MultipartMixed/ODataMultipartMixedBatchReader.cs
Outdated
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Core.Tests/ODataMultipartMixedBatchReaderTests.cs
Outdated
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Core.Tests/ODataMultipartMixedBatchReaderTests.cs
Outdated
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Core.Tests/ODataMultipartMixedBatchReaderTests.cs
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Core.Tests/ODataMultipartMixedBatchReaderTests.cs
Outdated
Show resolved
Hide resolved
@habbes Address comments, please have a look |
@habbes Gentle ping |
@quanterion looks good to me. Kindly rebase your branch with master. |
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.
Looks good to me, since the default for the new ThrowIfMissingContentIdChangeset
option preserves the existing behaviour of throwing an exception. Kindly resolve the conflicts with the master branch.
I've fixed the conflicts with the master branch. |
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
Issues
*This pull request adds ability to read OData 2.0 batch requests that do not require Content-ID header
Description
Add options to disable throwing exceptions if no Content-ID header is present in chgangeset
Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.