c# - How to pass long string in HttpClient.PostAsync request -
trying send rather long string rest web api (youtrack). following exception:
invalid uri: uri string long.
my code:
var encodedmessage = httputility.urlencode(message); var requesturi = string.format("{0}{1}issue/{2}/execute?comment={3}", url, youtrackresturl, issue.id, encodedmessage); var response = await httpclient.postasync(requesturi, null).configureawait(false); so took chances formurlencodedcontent
var requesturi = string.format("{0}{1}issue/{2}/execute", url, youtrackresturl, issue.id); var postdata = new list<keyvaluepair<string, string>>(); postdata.add(new keyvaluepair<string, string>("comment", message)); var content = new formurlencodedcontent(postdata); var response = await httpclient.postasync(requesturi, content).configureawait(false); which results in exact same issue.
the string (comment) sending, changed file set of commit svn. can long, don't have way around that. there way post content without string length restriction?
read following topics, didn't find answer there:
well short answer - put body, instead of trying push data via url
but work on ticket showed - answer here how set large string inside httpcontent when using httpclient?
the actual problem beeing in formurlencodedcontent
Comments
Post a Comment