Spring/인프런 토비의 Spring Boot
섹션 2-4 [스프링 부트 시작하기] Hello API 테스트
include_hoany
2024. 5. 29. 01:08
Hello API 테스트
HelloController 컨트롤러 메소드를 호출할 수 있는 HTTP Request를 생성하고 리털되는 HTTP Response를 확인한다.
HTTP 요청을 만들고 응답을 확인하는데 사용하는 도구
- curl
- HTTPie
- intelliJ IDEA Ultimate-http request
- Postman API Platform
- JUnit Test
- 등등등...
Http API를 테스트 한다는 점은 아래 사항을 고려해야한다.
- 바디의 값은 어떻게 전달되고 있는지
- 바디의 컨텐츠 타입은 어떻게 되어있는지
- 주고받는 헤더의 값은 어떻게 설정되어 있는지
intellij IDEA Ultimate-http Request Hello API 테스트
Request:
GET http://localhost:8080/hello?name=Spring boot
User-Agent: IntelliJ HTTP Client/IntelliJ IDEA 2024.1
Accept-Encoding: br, deflate, gzip, x-gzip
Accept: */*
content-length: 0
Response:
HTTP/1.1 200
Content-Type: text/plain;charset=UTF-8
Content-Length: 17
Date: Tue, 28 May 2024 10:02:15 GMT
Hello Spring boot