YouTrackSharp doesn't allow attaching files

First, per the instructions of YouTrackSharp I tried to submit an issue to youtrack.codebetter.com and couldn't access the site.

So I'm asking here:

When I try to attach a file, I get a NotAcceptable status back. Are attaching files supported by YouTrackSharp?

Here is the message:
EasyHttp.Infrastructure.HttpException : NotAcceptable Not Acceptable
 at EasyHttp.Http.HttpClient.ProcessRequest(String filename)
in HttpClient.cs: line 208
 at EasyHttp.Http.HttpClient.Post(String uri, IDictionary`2 formData, IList`1 files, Object query)
in HttpClient.cs: line 151
 at YouTrackSharp.Infrastructure.Connection.PostFile(String command, String path)
in c:\Users\VK185077\Downloads\YouTrackSharp-master\YouTrackSharp-master\src\YouTrackSharp\Infrastructure\Connection.cs: line 120
 at YouTrackSharp.Issues.IssueManagement.AttachFileToIssue(String issuedId, String path)
in c:\Users\VK185077\Downloads\YouTrackSharp-master\YouTrackSharp-master\src\YouTrackSharp\Issues\IssueManagement.cs: line 155
2 comments
Comment actions Permalink
Hello, Michael!
Could you please provide HTTP request that is actually sent to the server?
0
Comment actions Permalink
I'm not sure exactly what the HTTP request is (unless you help me know how to find that out from a program that uses YouTrackSharp as the wrapper to the REST API. The code that creates the request is pretty straightforward:

Code
    public void PostFile(string command, string path)
    {
      HttpClient httpRequest = this.CreateHttpRequest();
      httpRequest.Request.Accept = "application/xml";
      string fileContentType = this.GetFileContentType(path);
      List<FileData> list = new List<FileData>()
      {
        new FileData()
        {
          FieldName = "file",
          Filename = path,
          ContentTransferEncoding = "binary",
          ContentType = fileContentType
        }
      };
      httpRequest.Post(this._uriConstructor.ConstructBaseUri(command), (IDictionary<string, object>) null, (IList<FileData>) list, (object) null);
      this.HttpStatusCode = httpRequest.Response.StatusCode;
    }
prettyPrint();
0

Please sign in to leave a comment.