{
  "info": {
    "name": "第2周 房间查询与新增",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "本课 H2 示例家庭为 hh-03，无登录。先查询，再新增，再查询；重启会恢复初始数据。"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://127.0.0.1:8080",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "1 查询当前家庭的房间",
      "request": {
        "method": "GET",
        "header": [],
        "url": "{{baseUrl}}/api/rooms",
        "description": "预期 200。教师提供的初始数据为客厅、卧室。"
      },
      "response": []
    },
    {
      "name": "2 新增书房",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{baseUrl}}/api/rooms",
        "description": "完成练习后首次为 201，再次发送同名为 409。名称两端空格应去掉。",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"name\": \" 书房 \"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "3 空名称",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{baseUrl}}/api/rooms",
        "description": "完成名称检查后为 400。",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"name\": \"   \"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "4 重复名称",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{baseUrl}}/api/rooms",
        "description": "完成名称检查后为 409，数据不增加。",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"name\": \"客厅\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "5 缺少名称",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{baseUrl}}/api/rooms",
        "description": "教师提供的请求类型检查返回 400。",
        "body": {
          "mode": "raw",
          "raw": "{}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    }
  ]
}
