Skip to content

Commit

Permalink
Merge pull request #10 from yokra9/fix-add-useragent
Browse files Browse the repository at this point in the history
VRChat APIが403を返すようになったのでUserAgent文字列を追加
  • Loading branch information
nukora authored Apr 5, 2021
2 parents 5b515ba + 37cdd3d commit 3cbeb6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,19 @@ public class VRChatApiService
/// </summary>
private static JsonSerializerOptions jsonSerializerOptions;

/// <summary>
/// ユーザーエージェント文字列
/// </summary>
private static string userAgent = "Wget/1.20.3";

static VRChatApiService()
{
jsonSerializerOptions = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true,
};

client.DefaultRequestHeaders.Add("User-Agent", userAgent);
}

/// <summary>
Expand Down
10 changes: 10 additions & 0 deletions VRChatActivityLogViewer/VRChatActivityLogViewer/WebService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ public class WebService
/// </summary>
private static HttpClient client = new HttpClient();

/// <summary>
/// ユーザーエージェント文字列
/// </summary>
private static string userAgent = "Wget/1.20.3";

static WebService()
{
client.DefaultRequestHeaders.Add("User-Agent", userAgent);
}

/// <summary>
/// URIを指定して画像をダウンロードする
/// </summary>
Expand Down

0 comments on commit 3cbeb6f

Please sign in to comment.