AnWeber / vscode-httpyac

Quickly and easily send REST, Soap, GraphQL, GRPC, MQTT and WebSocket requests directly within Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=anweber.vscode-httpyac
MIT License
222 stars 20 forks source link

Escaping curly braces is not correctly interpreted #244

Closed efreibe closed 7 months ago

efreibe commented 7 months ago

If I make a request using this json code as body:

{
   "body": "\{\{1\}\} - \{\{2\}\} - \{\{3\}\}"
}

I can see in the log that it was sent as:

{
      "body": "{{1}} - \{\{2\}\} - {{3}}"
}

It always have to do with {{2}}, no other number causes this to fail. The order you send the {{2}} is not important, it always fails in decoding this specific escape sequence.

AnWeber commented 7 months ago

this is the code. I will test later. https://github.com/AnWeber/httpyac/blob/main/src/plugins/core/replacer/escapeVariableReplacer.ts

AnWeber commented 7 months ago

The regex was incorrect. But as I see it, that was really the only case that would not have worked. Congratulations

efreibe commented 7 months ago

It was a miracle that I needed to escape this specific string. I was actually testing whatsapp templates with variables and came across this. Thank you.

El vie, 8 de dic de 2023, 17:21, Andreas Weber @.***> escribió:

The regex was incorrect. But as I see it, that was really the only case that would not have worked. Congratulations

— Reply to this email directly, view it on GitHub https://github.com/AnWeber/vscode-httpyac/issues/244#issuecomment-1847795747, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIDCBSC6O3377SZW5CIJ2LYINZGLAVCNFSM6AAAAABAMZ3VS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBXG44TKNZUG4 . You are receiving this because you authored the thread.Message ID: @.***>