Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help me ,pls. I Need the RestSharp Post --data-binary Demo #1431

Closed
AtlantisDe opened this issue Feb 17, 2020 · 1 comment
Closed

help me ,pls. I Need the RestSharp Post --data-binary Demo #1431

AtlantisDe opened this issue Feb 17, 2020 · 1 comment
Labels

Comments

@AtlantisDe
Copy link

@AtlantisDe AtlantisDe commented Feb 17, 2020

help me ,plz I Need the --data-binary Post Demo

Original official document

//--data-binary
POST /urls?site=www.58.com&token=edk7ychrEZP9pDQD HTTP/1.1
User-Agent: curl/7.12.1 
Host: data.zz.baidu.com 
Content-Length: 83
http://www.example.com/1.html
http://www.example.com/2.html

I use the HttpClient Demo

--data-binary
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("User-Agent", "curl/7.12.1");
var stringContent = new StringContent("http://www.example.com/1.html\r\nhttp://www.example.com/2.html");
var response = httpClient.PostAsync("http://data.zz.baidu.com/urls?site=www.example.com&token=011QuJ3lXpE39bEd", stringContent).Result.Content.ReadAsStringAsync().Result;

I Need The RestSharp Demo,Now

  • I wrote something wrong, please help me fix it
// I wrote something wrong, please help me fix it
var client = new RestClient("http://data.zz.baidu.com/urls?site=www.example.com&token=011QuJ3lXpE39bEd");
client.AddDefaultHeader("User-Agent", "curl/7.12.1");
RestSharp.Parameter parameter = new Parameter("", "http://www.example.com/1.html\r\nhttp://www.example.com/2.html", ParameterType.RequestBody);
client.AddOrUpdateDefaultParameter(parameter);
var request = new RestRequest("statuses/home_timeline.json", DataFormat.Json);
var response = client.Post(request);

pls help me

tks very much
@repo-ranger

This comment has been minimized.

Copy link

@repo-ranger repo-ranger bot commented Feb 17, 2020

⚠️ This issue has been marked invalid and will be closed in 3 days

@AtlantisDe AtlantisDe changed the title help me ,pls. I Need the RestSharp Post Demo help me ,pls. I Need the RestSharp Post --data-binary Demo Feb 17, 2020
@AtlantisDe AtlantisDe closed this Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.