Giter VIP home page Giter VIP logo

Comments (3)

SylvainMarty avatar SylvainMarty commented on May 24, 2024

We managed to make this work by moving the actual persistent header we wanted to send in every request in the config.json file.

Under the Persistent Headers & Query Params section, we can read this:

Follow the prompts to add or edit persistent headers or query params. These are values that get sent with every request when using that profile.

I think this is misleading: the persistent headers are only sent by Restish when fetching the OpenAPI document but never when calling the actual API route.
Or maybe it's just a bug? 👀

from restish.

danielgtaylor avatar danielgtaylor commented on May 24, 2024

@SylvainMarty I'm actually unable to reproduce this issue. Can you try something for me? I set up a local API Bin instance on a port I can guarantee has nothing else running and ran against it with the following config:

$ cd apibin
$ go run . -p 8889
"apibin": {
    "base": "http://localhost:8889",
    "profiles": {
      "default": {
        "headers": {
          "x-cli-secret": "819d23ba-3ebd-408c-95ac-78abc93edc2c"
        }
      }
    }
  },

Here's an excerpt from the results:

$ restish apibin/ -v
...
DEBUG: Making request:
GET / HTTP/1.1
Host: localhost:8889
Accept: application/cbor;q=0.9,application/msgpack;q=0.8,application/ion;q=0.6,application/json;q=0.5,application/yaml;q=0.5,text/*;q=0.2,*/*
Accept-Encoding: gzip, br
User-Agent: restish-dev-2023-01-14-10:34
X-Cli-Secret: 819d23ba-3ebd-408c-95ac-78abc93edc2c


DEBUG: Got response from server in 3.181666ms:
...
DEBUG: Unmarshalling from application/cbor
HTTP/1.1 200 OK
Cache-Control: no-store
Content-Length: 394
Content-Type: application/cbor
Date: Wed, 18 Jan 2023 04:59:29 GMT
Etag: "jjGjNLAgnIQ"
Last-Modified: Tue, 01 Feb 2022 12:34:56 GMT
Link: </schemas/EchoModel.json>; rel="describedby"
Vary: *

{
  $schema: "http://localhost:8889/schemas/EchoModel.json"
  body: ""
  headers: {
    Accept: "application/cbor;q=0.9,application/msgpack;q=0.8,application/ion;q=0.6,application/json;q=0.5,application/yaml;q=0.5,text/*;q=0.2,*/*"
    Accept-Encoding: "gzip, br"
    User-Agent: "restish-dev-2023-01-14-10:34"
    X-Cli-Secret: "819d23ba-3ebd-408c-95ac-78abc93edc2c"
  }
  host: "localhost:8889"
  method: "GET"
  path: "/"
  url: "http://localhost:8889/"
}

As you can see the value is both in the debug-printed request and the response, meaning the server saw and echoed the value back to you. Same results if I add the auth name and same results if I use the OpenAPI-generated command like restish apibin get-echo --rsh-no-cache -v.

Can you try this on your side and see if you can repro the issue? I'm wondering if it could be related to your container and its mounts or whether it has a persistent disk or if something else might be going on.

FWIW, the code that builds the request is the same no matter which way it is called.

from restish.

danielgtaylor avatar danielgtaylor commented on May 24, 2024

Closing due to inactivity, feel free to reopen if needed.

from restish.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.