I am occasionally receiving a bad request error message when making API requests via YouTrackSharp. This only happens when running on the server, if I debug the app locally (running on IIS, not IIS Express), it goes through appropriately. Has anyone experienced this behavior before, and any suggestions?
Exception
YouTrackSharp.Infrastructure.InvalidRequestException: Bad Request ---> EasyHttp.Infrastructure.HttpException: BadRequest Bad Request
at EasyHttp.Http.HttpClient.ProcessRequest(String filename)
at YouTrackSharp.Infrastructure.Connection.MakePostRequest(String command, Object data, String accept)
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at YouTrackSharp.Issues.IssueManagement.ApplyCommand(String issueId, String command, String comment, Boolean disableNotifications, String runAs)
Calling Code
issueManagement.ApplyCommand(issue.Id,
string.Format("Ready For Testing Versions {0}", version),
string.Format("Marked Ready for Testing for {0} build, compiled {1}, by {2}",
version, utcDate.ToLocalTime(), user.UserName),
true);
public void ApplyCommand(string issueId, string command, string comment, bool disableNotifications = false, string runAs = "")
{
if (!_connection.IsAuthenticated)
{
throw new InvalidRequestException(Language.YouTrackClient_CreateIssue_Not_Logged_In);
}
try
{
dynamic commandMessage = new ExpandoObject();
commandMessage.command = command;
commandMessage.comment = comment;
if (disableNotifications)
commandMessage.disableNotifications = disableNotifications;
if (!string.IsNullOrWhiteSpace(runAs))
commandMessage.runAs = runAs;
_connection.Post(string.Format("issue/{0}/execute", issueId), commandMessage);
}
catch (HttpException httpException)
{
throw new InvalidRequestException(httpException.StatusDescription, httpException);
}
}