http-post

HTTP POST mutli part “BAD REQUEST”

蓝咒 提交于 2020-01-05 06:51:07
问题 I'm trying to upload a file using POST here's my request : POST /upload.php HTTP/1.1 Host: localhost Content-Type: multipart/form-data; boundary=---------------------------552335022525 Content-Length: 192 -----------------------------552335022525 Content-Disposition: form-data; name="userfile"; filename="12.txt" Content-Type: text/plain blabla -----------------------------552335022525-- Using HTTP live headers firefox plugin everything works but when putting it a char *buffer and send it with

Angular 5 HttpClient Post List to Web Api - always null?

依然范特西╮ 提交于 2020-01-05 06:44:10
问题 The setup is Angular 5 and .net core Web Api. At the controller, model binding always results in null while trying to bind to a complex object. Code is provided below. This example is adapted from another SO answer . but its not working for me. Controller: [Route("demopost1")] [HttpPost] public async Task < IntResultEntity > DemoPostList1([FromBody]DemoPostViewModel payload) { return await Task.FromResult(new IntResultEntity { Result = 0 }); } Models: public class DemoPostModel { public

Angular 5 HttpClient Post List to Web Api - always null?

旧城冷巷雨未停 提交于 2020-01-05 06:44:05
问题 The setup is Angular 5 and .net core Web Api. At the controller, model binding always results in null while trying to bind to a complex object. Code is provided below. This example is adapted from another SO answer . but its not working for me. Controller: [Route("demopost1")] [HttpPost] public async Task < IntResultEntity > DemoPostList1([FromBody]DemoPostViewModel payload) { return await Task.FromResult(new IntResultEntity { Result = 0 }); } Models: public class DemoPostModel { public

Spring Android - POST Request - URL Encoded Params from Class Object

我只是一个虾纸丫 提交于 2020-01-05 04:58:08
问题 I am trying to send some key-value pairs in Android Spring POST Request .It works correctly , if I am using a MultiValueMap<String, String> map= new LinkedMultiValueMap<String, String>(); for that. Is there any way to avoid MultiValueMap & directly send the Class Object as Request . One solution found is using Reflection , like the following for (Field field:objAuth.getClass().getDeclaredFields()){ field.setAccessible(true); map.add(field.getName(),field.get(objAuth)+""); } Code Snippet

Spring Android - POST Request - URL Encoded Params from Class Object

时光毁灭记忆、已成空白 提交于 2020-01-05 04:58:06
问题 I am trying to send some key-value pairs in Android Spring POST Request .It works correctly , if I am using a MultiValueMap<String, String> map= new LinkedMultiValueMap<String, String>(); for that. Is there any way to avoid MultiValueMap & directly send the Class Object as Request . One solution found is using Reflection , like the following for (Field field:objAuth.getClass().getDeclaredFields()){ field.setAccessible(true); map.add(field.getName(),field.get(objAuth)+""); } Code Snippet

How to submit a post request to a form?

别来无恙 提交于 2020-01-05 04:27:13
问题 Here is the test form Let's say i need to submit first name x and last name y . So , I can submit the get request simply by entering the following url http://www.w3schools.com/tags/demo_form_method.asp?fname=x&lname=y Now, if I change method="post" then the above method does not work. How can I submit the post request programatically and then print the resulting page to console ? I tried to use many methods . For example PostMethod post = new PostMethod("http://www.w3schools.com/tags/demo

Python HTTP Post method returns response as magicmock object instead of value

白昼怎懂夜的黑 提交于 2020-01-04 06:36:09
问题 I am trying to check the response status code after trigerring some API with a POST method, Response status code is of Magicmock instance type, i am checking whether the status code is inbetween 400 and 500 using comparison operator which works in python 2 but raises TypeError in python 3 import mock response = <MagicMock name='Session().post()' id='130996186'> Below code works in python 2 if (400 <= response.status_code <= 500): print('works') But when executed in python 3, raises TypeError:

Python HTTP Post method returns response as magicmock object instead of value

*爱你&永不变心* 提交于 2020-01-04 06:35:39
问题 I am trying to check the response status code after trigerring some API with a POST method, Response status code is of Magicmock instance type, i am checking whether the status code is inbetween 400 and 500 using comparison operator which works in python 2 but raises TypeError in python 3 import mock response = <MagicMock name='Session().post()' id='130996186'> Below code works in python 2 if (400 <= response.status_code <= 500): print('works') But when executed in python 3, raises TypeError:

How to POST raw whole JSON in the body of a Retrofit request?

不问归期 提交于 2020-01-04 05:38:29
问题 This question may have been asked before but no it was not definitively answered. How exactly does one post raw whole JSON inside the body of a Retrofit request? See similar question here. Or is this answer correct that it must be form url encoded and passed as a field? I really hope not, as the services I am connecting to are just expecting raw JSON in the body of the post. They are not set up to look for a particular field for the JSON data. I just want to clarify this with the restperts

how to increase request accept limit for asp classic

雨燕双飞 提交于 2020-01-04 04:38:31
问题 from java applet I am sending post request to asp classic. I am sending a very large data in this request ,which is csv data, when number of character in this request increases and get more then 138000 then asp does not accept the request and java applet give 500 error, so can anybody tell me how can I increase the size limit of accept request of asp classic. 回答1: Hard to say without knowing your server version. If IIS6 you would change the AspMaxRequestEntityAllowed property in the metabase