Comments (3)
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.
@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.
Closing due to inactivity, feel free to reopen if needed.
from restish.
Related Issues (20)
- separating commands by tags HOT 1
- Question: is it possible to generate request body from open api examples
- Header case modification makes restish unusable for some APIs with case senstive headers
- Downloading Restish on Windows? HOT 1
- http-basic password prompt is shown clear text
- Create API Specific Commands from PostgREST
- Support Flags for positional arguments and request bodies HOT 3
- Getting `Caught error: runtime error: invalid memory address or nil pointer dereference` trying to import basic OpenAPI spec HOT 1
- (Feature Request) - Allow restish to be used in non-interactive mode HOT 2
- Feature request: Per project configuration
- Allow base path elements to be ignored
- Stack Overflow error when renderSchemaInternal() is called
- Provide example using CLI Shorthand with API short name HOT 1
- Feature Request: make linkparsers take response and request as arguments
- Including '%' generates `invalid memory address or nil pointer dereference`
- Is opening OAuth Authorization Url in Browser broken on windows due missing url escaping? HOT 1
- redirect_mismatch v0.20.0 HOT 2
- Loading openapi schema with `default: null` generates `invalid memory address or nil pointer dereference`
- rest.sh domain has expired HOT 1
- anyOf option is not available as flag
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restish.