Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Zelka.Apis
- {
- using System.IO;
- using System.Text;
- public class StringRequestParameter : IRequestParameter
- {
- public StringRequestParameter(string key, string value)
- {
- this.Key = key;
- this.Value = value;
- }
- public string Value { get; set; }
- public string Key { get; set; }
- public void WriteToStream(Stream stream, string boundary, Encoding encoding)
- {
- const string template = "--{0}\r\nContent-Disposition: form-data; name=\"{1}\"\r\n\r\n{2}";
- string postData = string.Format(template, boundary, this.Key, this.Value);
- stream.Write(encoding.GetBytes(postData), 0, encoding.GetByteCount(postData));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement