spring-boot-request-respons.../README.md

104 lines
2.4 KiB
Markdown
Raw Normal View History

2023-10-10 09:08:44 +00:00
## `LoggingTestAPIController.java`
### logging test - get w/ body
2023-10-10 10:27:51 +00:00
2023-10-10 09:08:44 +00:00
```shell
curl -X GET 'http://localhost:20090/api/v1/loggingTest/getWithBody' \
--header 'Content-Type: application/json' \
--data '{
"value1" : "v1!",
"value2" : 123,
"value3" : false
}'
```
### logging test - get w/ param
2023-10-10 10:27:51 +00:00
2023-10-10 09:08:44 +00:00
```shell
curl http://localhost:20090/api/v1/loggingTest/get?p1=v1&p2=v2
```
### logging test - post w/o body, w/ error
2023-10-10 10:27:51 +00:00
2023-10-10 09:08:44 +00:00
```shell
curl -X POST 'http://localhost:20090/api/v1/loggingTest/postWithBody'
```
### logging test - post w/ body
2023-10-10 10:27:51 +00:00
2023-10-10 09:08:44 +00:00
```shell
curl -X POST 'http://localhost:20090/api/v1/loggingTest/postWithBody' \
--header 'Content-Type: application/json' \
--data '{
"value1" : "valu1!",
"value2" : 1111111,
"value3" : true
}'
```
# Appendix
## schema.sql for other dbms
### mysql
2023-10-10 10:27:51 +00:00
2023-10-10 09:08:44 +00:00
```mysql
create table request_log
(
2023-10-10 10:27:51 +00:00
id bigint auto_increment primary key,
application_name varchar(64),
http_method varchar(255),
uri varchar(255),
query_string varchar(2047),
content_type varchar(255),
body mediumtext,
requested_at timestamp(6),
trace_id varchar(40),
created_at timestamp(6),
2023-10-10 09:08:44 +00:00
primary key (id)
);
create table response_log
(
2023-10-10 10:27:51 +00:00
id bigint auto_increment primary key,
application_name varchar(64),
http_status integer,
content_type varchar(255),
body mediumtext,
responded_at timestamp(6),
trace_id varchar(40),
created_at timestamp(6),
2023-10-10 09:08:44 +00:00
primary key (id)
);
```
### postgresql
2023-10-10 10:27:51 +00:00
2023-10-10 09:08:44 +00:00
```postgresql
create table request_log
(
2023-10-10 10:27:51 +00:00
id bigint generated by default as identity primary key,
application_name varchar(64),
http_method varchar(255),
uri varchar(255),
query_string varchar(255),
content_type varchar(255),
body text,
requested_at timestamp(6) with time zone,
trace_id varchar(40),
created_at timestamp(6) with time zone
2023-10-10 09:08:44 +00:00
);
create table response_log
(
2023-10-10 10:27:51 +00:00
id bigint generated by default as identity primary key,
application_name varchar(64),
http_status integer,
content_type varchar(255),
body text,
responded_at timestamp(6) with time zone,
trace_id varchar(40),
created_at timestamp(6) with time zone
2023-10-10 09:08:44 +00:00
);
```