공식문서를 보고 자주 사용할만한 것들을 간단하게 정리한 글입니다. 자세한 내용은 공식문서를 참고해주세요.
ref: https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html
사실 2번이 크다고 생각합니다. 요청과 응답의 가시성이 좋고, 직접 실행도 해볼수 있기 때문이죠.
추가적으로 http test를 할 수도 있습니다.
https://blog.jetbrains.com/idea/2022/12/http-client-cli-run-requests-and-tests-on-ci/
github action
https://github.com/marketplace/actions/intellij-http-client-action
>
또는 > {% %}
로 시작
< scripts/my-script.js
POST https://example.org/pets/{{petName}}
< {%
request.variables.set("petName", "Bella")
%}
POST https://example.org/pets/{{petName}}
<
또는 < {% %}
로 시작
GET host/api/test
> scripts/my-script.js
GET host/api/test
> {%
// Response Handler Script ...
%}
ref: https://www.jetbrains.com/help/idea/exploring-http-syntax.html#using_request_vars
@var = value
@host = localhost:8080
GET {{host}}/api
< {%
request.variables.set("key", "value")
%}
.http
GET {{client.host.url}}
http-client.env.json
{
"dev":{
"client": {
"host": {
"url": "example.org"
}
}
}
}
.gitignore
파일에 추가하지 않아도 추적되지 않음.gitignore
파일에 수동으로 추가해줘야함http-client.private.env.json
$uuid
or $random.uuid
: generates a universally unique identifier (UUID-v4)$timestamp
: generates the current UNIX timestamp$isoTimestamp
: generates the current timestamp in ISO-8601 format for the UTC timezone.$randomInt
: generates a random integer between 0 and 1000.$random.integer(from, to)
: generates a random integer between from (inclusive) and to (exclusive), for example random.integer(100, 500). If you provide no parameters, it generates a random integer between 0 and 1000.$random.float(from, to)
: generates a random floating point number between from (inclusive) and to (exclusive), for example random.float(10.5, 20.3). If you provide no parameters, it generates a random float between 0 and 1000.$random.alphanumeric(length)
: generates a sequence of uppercase and lowercase letters, digits, and underscores of length length (must be greater than 0).$random.hexadecimal(length)
: generates a random hexadecimal string of length length (must be greater than 0).$random.email
: generates a random email address.$exampleServer
: is replaced with the IntelliJ IDEA built-in web server, which can be accessed using HTTP Client only. The variable is used in GraphQL and WebSocket examples.< {%
request.variables.set("id", [1,2,3,4,5])
%}
GET http://localhost:8080/books/{{id}}
.idea/httpRequests/
경로에 자동저장됩니다.domain path name value date
.example.com / userId 0x4d2 -1
// @no-cookie-jar
GET ~
POST ~
Cookie: key=first-value
// @no-redirect
GET ~
오 또 올리셨군요 ㅋㅋ 잘 읽겠습니다.