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.
@brianjmiller this is ready for you to review.
It solves a problem where if the etag options property is not set, both saveActivityProfile and saveAgentProfile will not set the etag header, which is a bad request and will result in a conformant LRS returning 400. This means that in scenarios where there is no etag (e.g. the resource is being PUT for the first time), there's no way to make a valid request.
I did consider that since this is a change in behavior, we should add an additional 'if-none' options property to allow people to explicitly set the if-none-match header, however since a conformant LRS will always reject requests without that header, I didn't see the point in supporting not setting that header.
This PR does nothing to address the related issue that there is no way to set the If-None-Match header for PUT requests to the State API. In that case, the etag header is optional so we would need to continue to support sending no-etag-header requests to avoid a breaking change.
This PR has been tested with the Moodle xAPI launch plugin and I have confirmed that this change fixes davidpesce/moodle-mod_tincanlaunch#140.