Angularjs $http.post to contact form 7 with content type application/x-www-form-urlencoded
Date : March 29 2020, 07:55 AM
should help you out To POST data with content type application/x-www-form-urlencoded, the data needs to be urlencoded. Use the $httpParamSerializer service: //this.sendMessage = function(successCallback, errorCallback){
this.sendMessage = function(){
var config = {
//USE serializer
transformRequest: $httpParamSerializer,
headers:{
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json, text/javascript, */*;q=0.01'
}
};
var data = {
'_wpcf7':4,
'_wpcf7_version':4.7,
'_wpcf7_locale':'en_US',
'_wpcf7_unit_tag':'wpcf7-f4-p6-o1',
'fname':'john',
'email':'admin@example.com',
'subject':'subject',
'message':'message',
'_wpcf7_is_ajax_call':1
};
//vvvv RETURN httpPromise
return $http.post('/be/home', data, config);
};
|
my request failed when the post 'content-type' is application/x-www-form-urlencoded and * form field param= { <this i
Date : March 29 2020, 07:55 AM
this will help The request is failed when I post request an API whose header content-type is 'application/x-www-form-urlencoded; charset=UTF-8' and post body is ' param = { this is a json object} ' And form field param = {"cityid":"2091afc3-bcd6-46d9-8033-3548ad10933b","areaid":"2d09f5e5-a07d-445c-9d8a-51eb436699a8","hosid":"0f226b63-58ad-44d7-bf23-25d0345276e1","deptid":"91c176f5-63ca-4b95-87c4-9f311864ff9b","barcode":"1000000000","mothername":"manual-mother1","pregweek":"21","pregday":"1","midentitycard":"","birthday":"2018-10-01 00:00" ...... and so on }
|
How to post request with spring boot web-client for Form data for content type application/x-www-form-urlencoded
Date : March 29 2020, 07:55 AM
should help you out How To use spring boot webclient for posting request with content type application/x-www-form-urlencoded sample curl request with content type `application/x-www-form-urlencoded' , We can use BodyInserters.fromFormData for this purpose webClient client = WebClient.builder()
.baseUrl("SOME-BASE-URL")
.defaultHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_FORM_URLENCODED_VALUE)
.build();
return client.post().uri("SOME-URI)
.body(BodyInserters.fromFormData("username", "SOME-USERNAME")
.with("password", "SONE-PASSWORD"))
.retrieve()
.bodyToFlux(SomeClass.class)
.onErrorMap(e->new MyException("messahe",e))
.blockLast();
}
|
Http Post request with content type application/x-www-form-urlencoded not working in Spring
Tag : java , By : user178709
Date : March 29 2020, 07:55 AM
|
Sending form-data / application/x-www-form-urlencoded body for OpenWhisk/Kitura Swift HTTP POST Request
Date : March 29 2020, 07:55 AM
Hope this helps You can use request.readString() to read the body information in its raw format. If you have the BodyParser middleware in play using: router.all("/name", middleware: BodyParser())
router.post("/name") { request, response, next in
guard let parsedBody = request.body else {
next()
return
}
switch parsedBody {
case .urlEncoded(let data):
let name = data["name"].string ?? ""
try response.send("Hello \(name)").end()
default:
break
}
next()
}
|