#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

meta:
  version: "1.0"

sessions:
- transactions:
  - client-request:
      method: "GET"
      version: "1.1"
      url: /ref/block
      headers:
        fields:
          - [ Host, example.com ]
          - [ uuid, 1 ]
          - [ Range, bytes=0-9 ]
    server-response:
      status: 206
      reason: OK
      headers:
        fields:
          - [ Content-Length, 10 ]
          - [ Content-Range, { value: "bytes 0-9/16", as: equal}]
          - [ Cache-Control, max-age=300 ]
          - [ X-Response, cached_response ]
    proxy-response:
      status: 206
      headers:
        fields:
          - [ Content-Length, { value: "10", as: equal} ]
          - [ Content-Range, { value: "bytes 0-9/16", as: equal}]
          - [ X-Response, { value: cached_response, as: equal} ]

  - client-request:
      method: "GET"
      version: "1.1"
      url: /ref/block
      headers:
        fields:
          - [ Host, example.com ]
          - [ uuid, 2 ]
          - [ Range, bytes=10-19 ]
    server-response:
      status: 206
      reason: OK
      headers:
        fields:
          - [ Content-Length, 6 ]
          - [ Content-Range, { value: "bytes 10-15/16", as: equal}]
          - [ Cache-Control, max-age=300 ]
          - [ X-Response, cached_response ]
    proxy-response:
      status: 206
      headers:
        fields:
          - [ Content-Length, { value: "6", as: equal} ]
          - [ Content-Range, { value: "bytes 10-15/16", as: equal}]
          - [ X-Response, { value: cached_response, as: equal} ]

  - client-request:
      method: "PURGE"
      version: "1.1"
      url: /ref/block
      headers:
        fields:
          - [ Host, example.com ]
          - [ Range, bytes=10-15 ]
          - [ uuid, 3 ]
    server-response:
      status: 200
      reason: OK
      headers:
        fields:
          - [ Content-Length, 0 ]
    proxy-response:
      status: 200
      headers:
        fields:
          - [ Content-Length, { value: "0", as: equal} ]

  - client-request:
      method: "GET"
      version: "1.1"
      url: /ref/block
      headers:
        fields:
          - [ Host, example.com ]
          - [ Range, bytes=0-5 ]
          - [ uuid, 4 ]
    server-response:
      status: 404
      headers:
        fields:
          - [ Content-Length, 0 ]
          - [ X-Response, internal_server_error ]
    proxy-response:
      status: 206
      headers:
        fields:
          - [ Content-Range, { value: "bytes 0-5/16", as: equal}]
          - [ X-Response, { value: cached_response, as: equal} ]