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

help with http-client.env.json from intellij #289

Closed martinm1000 closed 1 month ago

martinm1000 commented 1 month ago

Hi,

I'm trying to use working intellij .http files in vscode (which I'm not very familliar with). I've seen from your documentation that http-client.env.json placed beside a .http file should be recognized, but when I try to select an environment, the popup (select environment) doesn't list anything ?

requests works great if I hardcode my variables, so... am I doing something wrong ?

AnWeber commented 1 month ago

Hi Take a Look in my examples https://github.com/httpyac/httpyac.github.io/tree/main/examples/project/intellijEnvironments. These should work.

@martinm1000 I have also just tested it locally. My example works as expected. Did the example help you?

martinm1000 commented 1 month ago

Hi !

Your example works !

Mine doesn't and I'm still looking at finding out why. Anything special in your processing of the contents of the files ?

Do your plugin have a log file somewhere that could help ?

AnWeber commented 1 month ago

See output for logs. image

martinm1000 commented 1 month ago

Ok, I think I found out the source of the problem ! It appears I have unicode BOM bytes in my json files, which also existed in the files in Rider. When modifying your own example files, I also got the problem and I see : image

So I guess the problem is on my env. Had this problem with xml files in the past, its a first with JSON !

martinm1000 commented 1 month ago

I can confirm this is my problem, thank you. I'll need to sort out why I get these, As it looks like this is illegal for json files it seems.

image

https://en.wikipedia.org/wiki/Byte_order_mark#Byte-order_marks_by_encoding

Thank you !

AnWeber commented 1 month ago

According to RFC default is UTF-8. https://www.rfc-editor.org/rfc/rfc4627#section-3 I read the bytestream in this encoding, without any fallback or encoding detection.

martinm1000 commented 1 month ago

Yeah, the (updated) spec mentions that BOM bytes should not be used, so even if intellij seems to not have a problem with them, I guess you do not have anything else to fix on your side (unless you want to ignore those bytes). https://www.rfc-editor.org/rfc/rfc7159#section-8.1

AnWeber commented 1 month ago

Nah, using only UTF-8 without BOM feels fine for me. :-)