VBA-tools / VBA-Web

VBA-Web: Connect VBA, Excel, Access, and Office for Windows and Mac to web services and the web
http://vba-tools.github.io/VBA-Web/
MIT License
2.01k stars 494 forks source link

Curl requests > 1023 characters fail owing to strings being pushed to multi line #322

Open apatel-rms opened 6 years ago

apatel-rms commented 6 years ago

When a curl request has more than 1023 characters, VBA inserts a new line into the string web_Curl within WebClient. This can cause the WebHelpers.ExecuteInShell(web_curl) function to fail as the curl request is incomplete on a single line.

This can be fixed by creating a multi-line curl command instead and allowing the request to go over multiple lines.

apatel-rms commented 6 years ago

Making the following modification within the PrepareCurlRequest function does the trick

 ' Set headers and cookies
For Each web_KeyValue In request.Headers
    web_Curl = web_Curl & "\" & Chr(10) & " -H '" & web_KeyValue("Key") & ": " & web_KeyValue("Value") & "'"
Next web_KeyValue
timhall commented 6 years ago

Cool, thanks for raising this issue @apatel-rms I'll make the fix soon