# Http with forceHttp1 true

**URL:** <https://forum.servoy.com/t/http-with-forcehttp1-true/20993>\
**Category:** Questions\
**Created:** [May 1, 2023, 8:49am UTC](https://forum.servoy.com/t/http-with-forcehttp1-true/20993 "2023-05-01T08:49:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JuanMartin](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@JuanMartin](https://forum.servoy.com/u/JuanMartin)\
**Post date:** [May 1, 2023, 8:49am UTC](https://forum.servoy.com/t/http-with-forcehttp1-true/20993/1 "2023-05-01T08:49:45Z")

</div>

Hi

In Servoy 2023.03.0, I try to send any image to Prestashop 1.7.6.7 with the Http protocol forceHttp1 true, but dosen’t work

I use this code:

```auto
  var config=plugins.http.createNewHttpClientConfig();
    config.forceHttp1=true; 
    cliHttp = plugins.http.createNewHttpClient(config);
    	var postRequest = cliHttp.createPostRequest(url);
	postRequest.addHeader('enctype', 'multipart/form-data');
	postRequest.addHeader('method', 'POST');
	postRequest.addParameter('Content-Disposition', 'form-data;name="image"');
	postRequest.addParameter('Content-Type', content);
	postRequest.addFile('image', tempFile);
	response = postRequest.executeRequest();
	
	result = utils.stringReplace(response.getResponseBody(), "><", ">\n<");

```

It took a long time to respond and when it does it gives this error:  
ERROR com.servoy.j2db.util.Debug - response.getResponseBody API was called while response is null due to request exception: java.net.SocketTimeoutException: 50000 MILLISECONDS

Thanks

---

<div class="post-metadata">

**Author:** ![JuanMartin](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@JuanMartin](https://forum.servoy.com/u/JuanMartin)\
**Post date:** [May 8, 2023, 6:38pm UTC](https://forum.servoy.com/t/http-with-forcehttp1-true/20993/2 "2023-05-08T18:38:32Z")

</div>

It is already working, in case someone needs it, it is as follows:

```auto
var url = 'https://prestashop_url /api/images/products/' + product_prestahop_id;
    var config=plugins.http.createNewHttpClientConfig();
    config.forceHttp1=true;
    cliHttp = plugins.http.createNewHttpClient(config);
    var postRequest = cliHttp.createPostRequest(url);
	postRequest.addHeader('enctype', 'multipart/form-data');
	postRequest.addHeader('method', 'POST');
	postRequest.addParameter('Content-Disposition', 'form-data;name="image"');
	postRequest.addParameter('Content-Type', content);
	postRequest.addFile('image', tempFile);
	postRequest.forceMultipart(true);
	postRequest.usePreemptiveAuthentication(true);
	response = postRequest.executeRequest(_sa.presta_clientes ,"a");
	result = utils.stringReplace(response.getResponseBody(), "><", ">\n<");

```

---

<div class="post-metadata">

**Author:** ![JuanMartin](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@JuanMartin](https://forum.servoy.com/u/JuanMartin)\
**Post date:** [June 16, 2023, 11:59am UTC](https://forum.servoy.com/t/http-with-forcehttp1-true/20993/3 "2023-06-16T11:59:01Z")

</div>

Hi  
I update to Servoy 2023.3.2 and forceHttp1=true dosen´t works again  
With the Servoy 2023.3.1 it worked perfectly

I do not see that there has been any modification of this part in the documentation, but the truth is that with Servoy 2023.3.2 it does not work

Thanks
