Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(202)

Unified Diff: Src/GoogleApis/Apis/Requests/ClientServiceRequest.cs

Issue 96320045: Issue 464: Error when setting an invalid etag (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: minor Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Src/GoogleApis.Tests/Apis/Requests/ClientServiceRequestTest.cs ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Src/GoogleApis/Apis/Requests/ClientServiceRequest.cs
===================================================================
--- a/Src/GoogleApis/Apis/Requests/ClientServiceRequest.cs
b/Src/GoogleApis/Apis/Requests/ClientServiceRequest.cs
@@ -185,7 185,6 @@
object body = GetBody();
request.SetRequestSerailizedContent(service, body, overrideGZipEnabled.HasValue
? overrideGZipEnabled.Value : service.GZipEnabled);
-
AddETag(request);
return request;
}
@@ -233,15 232,25 @@
IDirectResponseSchema body = GetBody() as IDirectResponseSchema;
if (body != null && !string.IsNullOrEmpty(body.ETag))
{
var etag = body.ETag;
ETagAction action = ETagAction == ETagAction.Default ? GetDefaultETagAction(HttpMethod) : ETagAction;
- switch (action)
try
{
- case ETagAction.IfMatch:
- request.Headers.IfMatch.Add(new EntityTagHeaderValue(body.ETag));
- break;
- case ETagAction.IfNoneMatch:
- request.Headers.IfNoneMatch.Add(new EntityTagHeaderValue(body.ETag));
- break;
switch (action)
{
case ETagAction.IfMatch:
request.Headers.IfMatch.Add(new EntityTagHeaderValue(etag));
break;
case ETagAction.IfNoneMatch:
request.Headers.IfNoneMatch.Add(new EntityTagHeaderValue(etag));
break;
}
}
// When ETag is invalid we are going to create a request anyway.
// See https://code.google.com/p/google-api-dotnet-client/issues/detail?id=464 for more details.
catch (FormatException ex)
{
Logger.Error(ex, "Can't set {0}. Etag is: {1}.", action, etag);
}
}
}
« no previous file with comments | « Src/GoogleApis.Tests/Apis/Requests/ClientServiceRequestTest.cs ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b