curl 명령 서버 측 테스트 api 인터페이스

1029 단어 linux
curl 명령 은 인 터 페 이 스 를 테스트 하 는 데 사용 할 수 있 습 니 다. 개발 에 서 는 curl 명령 을 사용 하여 nginx 나 응용 서버 에서 인 터 페 이 스 를 검사 하여 문 제 를 찾 을 수 있 습 니 다.인터페이스 디 버 깅 에 사용 되 는 curl 장면 을 간단하게 기록 합 니 다.
1. curl 테스트 Get 형식 api 가 nginx 에서 테스트 하면 여기 localhost: 80 은 ng 의 주소 포트 입 니 다. 응용 서버 에 있 으 면 서버 의 주소 와 응용 설정 을 응용 하 는 감청 포트 입 니 다. - v 파 라 메 터 를 추가 하면 자세 한 정 보 를 볼 수 있 습 니 다.
curl localhost:80/api/test 

2. curl 테스트 게시 물 형식 api
    @RequestParam         
curl  localhost:80/api/test  -X POST -d "title=comewords&content=articleContent"

    @RequestBody         
curl  localhost:80/api/test -X POST -H "Content-Type:application/json" -d '"title":"comewords","content":"articleContent"'

post 요청 한 인자 도 다음 과 같이 쓸 수 있 습 니 다 – data 의 형식:
curl localhost:80/api/test -X POST -H "Content-Type:application/json" --data '{"title":"comewords","content":"articleContent"}'

좋은 웹페이지 즐겨찾기