Permalink
Browse files

Change the content type from application/url-encoded to application/j…

…son.
  • Loading branch information...
Copyleaks committed Sep 4, 2018
1 parent 544b075 commit 6006594f981692bc6311036b7c15ad46ed2e0b2c
@@ -2,7 +2,7 @@
<package>
<metadata>
<id>CopyleaksAPI</id>
<version>3.5.1</version>
<version>3.5.2</version>
<title>Copyleaks Plagiarism Checker API</title>
<authors>Copyleaks LTD</authors>
<owners>Copyleaks LTD</owners>
@@ -27,8 +27,6 @@ namespace Copyleaks.SDK.API
public static class HttpContentTypes
{
public static readonly string Json = "application/json";
public static readonly string Xml = "application/xml";
public static readonly string UrlEncoded = "application/x-www-form-urlencoded";
public static readonly string PlainText = "text/plain";
}
}
@@ -13,5 +13,5 @@
[assembly: Guid("a3164d12-0f18-497d-8ec4-470a9bc6e286")]
[assembly: AssemblyVersion("3.4.2")]
[assembly: AssemblyFileVersion("3.4.2")]
[assembly: AssemblyVersion("3.6")]
[assembly: AssemblyFileVersion("3.6")]
@@ -25,6 +25,7 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using Copyleaks.SDK.API.Exceptions;
using Copyleaks.SDK.API.Extentions;
using Newtonsoft.Json;
@@ -54,11 +55,11 @@ public static LoginToken Login(string email, string apiKey)
using (HttpClient client = new HttpClient())
{
client.SetCopyleaksClient(HttpContentTypes.Json);
HttpResponseMessage msg = client.PostAsync(LOGIN_PAGE, new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("email", email),
new KeyValuePair<string, string>("apikey", apiKey),
})).Result;
HttpResponseMessage msg = client.PostAsync(LOGIN_PAGE, new StringContent(JsonConvert.SerializeObject(new
{
email = email,
apikey = apiKey
}), Encoding.UTF8, HttpContentTypes.Json)).Result;
if (!msg.IsSuccessStatusCode)
throw new CommandFailedException(msg);
BIN +512 Bytes (100%) CopyleaksAPI/lib/CopyleaksAPI.dll
Binary file not shown.

0 comments on commit 6006594

Please sign in to comment.