Skip to content
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

Fix x-ms-request-id header null reference #381

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

trickpatty
Copy link

This fix addresses a null reference issue in the CdmHttpClient class.

When attempting to use the NetworkAdapter to access files on a host, if the host does not return the x-ms-request-id header in the response, a null reference exception would be thrown. This change fixes the null reference exception by checking to see if the header exists in the response before attempting to access the value.

This change also includes a test which will now pass, given that the fix is in place.

In order to run the tests, a reference to Moq needed to be added to the Tests project.

Scott Kearney added 4 commits August 7, 2024 14:23
If no value is found, getFirstHeader returns null. Accessing getValue throws an error.
If no value is found, GetValues returns null. Accessing FirstOrDefault throws an error.
Moq is referenced in the code, but wasn't defined as a package for the project.
Test should run successfully when the x-ms-request-id header null reference is fixed.
@trickpatty trickpatty marked this pull request as ready for review August 7, 2024 19:58
@trickpatty
Copy link
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant