Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

extend requests #13

@kyleect

Description

@kyleect

It would be nice to be able to define a base request

---
base: true
id: base
headers:
  host: "{{$ baseUrl}}"
  accept: application/json
  user-agent: "{{$ userAgent}}"
  authorization: "Bearer {{! secretToken}}"
---
extends: base
id: posts/getPosts
description: Get all posts from the blog
http: |+
  GET /posts HTTP/1.1

---

Overall

  • Mixing base requests in with the "defined" requests makes working with restfiles harder. The consumer must now sort between these two types
    • Possible solutions would be sort the requests so parse returns [collection, data, baseRequests, ...requests] OR implement restfile objects and let that abstract it. restfile.baseRequests and restfile.requests

Parsing

  • Merge base request in to extending request
  • Retain base request after parsing
  • Populate variables, secrets and prompts in base requests

Validation

  • request.extends references requests that exist and marked base: true
  • request.http should not be defined on base requests

Future

  • It would be nice to support base requests defining http and merging them. Doing this with the verb, target, headers wouldn't be too hard. This will be trickier with body because it will depend on what that body content is. In most cases there won't be a good merge strategy other than prepend or append. Even then which one? Some body content types like application/json could be merged but that's not straight forward and there are different algorithms for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions