Skip to content

Commit 37e7583

Browse files
committed
Skip user agent HTTP header validation (microsoft#10279)
* Skip user agent HTTP header validation In microsoft#8392, we added logic to skip HTTP header validation for `User-Agent` in the NetworkingModule. Now that NetworkingModule is being refactored, we need this change in the new implementation. This change skips user agent validation in the new networking module. * Change files
1 parent 175d7a5 commit 37e7583

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

vnext/Shared/Networking/WinRTHttpResource.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,13 @@ namespace Microsoft::React::Networking {
229229
co_return m_onError(coReqArgs->RequestId, "Failed to append Authorization");
230230
}
231231
}
232+
else if (boost::iequals(header.first.c_str(), "User-Agent")) {
233+
bool success =
234+
coRequest.Headers().TryAppendWithoutValidation(to_hstring(header.first), to_hstring(header.second));
235+
if (!success && m_onError) {
236+
co_return m_onError(coReqArgs->RequestId, "Failed to append User-Agent");
237+
}
238+
}
232239
else {
233240
try {
234241
coRequest.Headers().Append(to_hstring(header.first), to_hstring(header.second));

0 commit comments

Comments
 (0)