回答編集履歴

3

修正

2019/03/12 08:30

投稿

Zuishin
Zuishin

スコア28660

test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  // メッセージ追加
48
48
 
49
- postData = "\r\n--------------------------" + boundary + "\r\n";
49
+ postData = "--------------------------" + boundary + "\r\n";
50
50
 
51
51
  postData += "Content-Disposition: form-data; name=\"message\"\r\n\r\n";
52
52
 

2

メッセージとバイナリを間違っていたので修正

2019/03/12 08:30

投稿

Zuishin
Zuishin

スコア28660

test CHANGED
@@ -38,21 +38,23 @@
38
38
 
39
39
  ```C#
40
40
 
41
+ var _postData = enc.GetBytes(postData).ToList();
42
+
43
+ _postData.AddRange(readData);
44
+
45
+
46
+
41
47
  // メッセージ追加
42
48
 
43
- postData += "--------------------------" + boundary + "\r\n";
49
+ postData = "\r\n--------------------------" + boundary + "\r\n";
44
50
 
45
51
  postData += "Content-Disposition: form-data; name=\"message\"\r\n\r\n";
46
52
 
47
53
  postData += "I attached comment to chat.\r\n";
48
54
 
55
+ postData += "--------------------------" + boundary + "--";
49
56
 
50
-
51
- var _postData = enc.GetBytes(postData).ToList();
52
-
53
- _postData.AddRange(readData);
57
+ _postData.AddRange(enc.GetBytes(postData));
54
-
55
- _postData.AddRange(enc.GetBytes("\r\n--------------------------" + boundary + "--"));
56
58
 
57
59
  ```
58
60
 

1

バイナリの後に改行を挿入

2019/03/12 06:51

投稿

Zuishin
Zuishin

スコア28660

test CHANGED
@@ -52,7 +52,7 @@
52
52
 
53
53
  _postData.AddRange(readData);
54
54
 
55
- _postData.AddRange(enc.GetBytes("--------------------------" + boundary + "--"));
55
+ _postData.AddRange(enc.GetBytes("\r\n--------------------------" + boundary + "--"));
56
56
 
57
57
  ```
58
58