Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 |
Tags
- CKA 기출문제
- tucker의 go 언어 프로그래밍
- 정보처리기사 실기 기출문제
- MySQL
- AI
- Pinpoint
- LLM
- golang
- 오블완
- kotlin
- 기록으로 실력을 쌓자
- aws
- SRE
- Rag
- Kubernetes
- AWS EKS
- Java
- kotlin coroutine
- HARNESS
- PETERICA
- CloudWatch
- 공부
- 티스토리챌린지
- 바이브코딩
- Linux
- minikube
- 코틀린 코루틴의 정석
- CKA
- go
- Spring
Archives
- Today
- Total
피터의 개발이야기
[Postman] 테스트 발송 시 현재시간, 램덤숫자 넣기 본문
반응형

ㅁ 개요
ㅇ Postman 테스트 요청 시 현재시간, 램덤 숫자를 생성하여 Body에 대입하는 방법 정리
ㅁ Pre-request Script

var moment = require('moment')
pm.globals.set("currentDate", moment().format("YYYYMMDDHHmmss"));
pm.globals.set("intRnd", _.random(100000, 999999))
ㅇ Java Script 문법을 사용한다.
ㅇ moment를 이용해 currentDate를 생성하였다.
ㅇ _.random으로 intRnd을 생성하였다.
ㅁ 생성된 데이터 사용

ㅇ 이중 {{}}를 사용하여 생성된 값을 바인딩한다.
ㅁ 함께 보면 좋은 사이트
ㅇ https://learning.postman.com/docs/writing-scripts/pre-request-scripts/
Writing pre-request scripts | Postman Learning Center
Writing pre-request scripts: documentation for Postman, the collaboration platform for API development. Create better APIs—faster.
learning.postman.com
반응형
'DevTool > Postman' 카테고리의 다른 글
| [Postman] Postman 오프라인 사용방법 (1) | 2025.02.28 |
|---|---|
| [Postman] Postman의 Workspace: API 개발자의 디지털 작업실 (0) | 2025.02.27 |
| [Postman] Postman에서 응답값을 변수 사용하기 (0) | 2022.05.29 |
| Postman으로 push 보내기 (0) | 2021.01.22 |
Comments