Giter Site home page Giter Site logo

restcli / restcli Goto Github PK

View Code? Open in Web Editor NEW
277.0 277.0 35.0 23 MB

A rest-cli for intellij http-request. ---> https://blog.jetbrains.com/idea/2022/12/http-client-cli-run-requests-and-tests-on-ci/

Home Page: https://restcli.github.io

License: MIT License

Kotlin 54.69% Java 33.45% Shell 0.50% Lex 7.12% JavaScript 4.09% Dockerfile 0.16%
command-line http-client intellij-idea jfex kotlin rest-client

restcli's Introduction

Jetbrains released a new cli client.

Please check it.

This repository will no longer active development.

Thank you for trying & feedback.

I learn so much from all you guys here.

Blog: http-client-cli-run-requests-and-tests-on-ci

All Contributors


restcli
restcli

A missing commandline application for execute IntelliJ HTTP Client file.

restcli restcli

Key FeaturesHow To UseDownloadCreditsLicenseProducthunt

screenshot

Key Features

  • Written in Kotlin 🤩
  • Execute Intellij HTTP request files
  • Running test script including:
    • Embedded script inside HTTP request file
    • Include external javascript test file
  • Loading and inject environment variables from
    • http-client.env.json
    • http-client.private.env.json
  • Cross-platform 💻🖥️
    • Windows, macOS, and Linux ready.
  • Beautiful request log 🤑🤑🤑
    • Request & response detail
    • Test result table
  • Easy to custom via command-line arguments 😎
    • Custom logging request
    • Inject environment name
  • Generate test report - JUnit format. 🥰🥰🥰
  • Support setNextRequest. So you can custom flexible the test flow. ✨✨✨
Demo

demo-rest-cli

1. Show detail request/response including test result

request-with-test-success

request-with-test-failed

2. Test result table

test-result-table

3. Generate JUnit test report (XML) that can be viewed by other tools such as xunit-viewer

generate-junit-test-report

How To Use

The fastest way to get rest cli is to download the jar from releases tab

Usage: rest-cli [-hkV] [-d=<environmentFilesDirectory>] [-D=<decorator>]
                [-e=<environmentName>] [-l=<logLevel>] [-t=<requestTimeout>]
                [-G=<String=String>]... [-P=<String=String>]... FILES...
IntelliJ RestCli
      FILES...     Path to one ore more http script files.
  -d, --env-dir=<environmentFilesDirectory>
                   Directory where config files are (default: current directory)
                   (http-client.env.json/http-client.private.env.json).
  -D, --decorator=<decorator>
                   Decorator for private env variables
                   Valid values: NOOP, THREE_STAR, FULL_STAR, MIDDLE_STAR
  -e, --env=<environmentName>
                   Name of the environment in config file
                   (http-client.env.json/http-client.private.env.json).
  -G, --global-env=<String=String>
                   Public environment variables
  -h, --help       Show this help message and exit.
  -k, --insecure   Disable ssl validation
  -l, --log-level=<logLevel>
                   Config log level while the executor running.
                   Valid values: NONE, BASIC, HEADERS, BODY
  -P, --private-env=<String=String>
                   Private environment variables
  -t, --timeout=<requestTimeout>
                   Number of milliseconds for request timeout, default=3000
  -V, --version    Print version information and exit.

Example

# Move to the folder that contains your http files.
$ cd requests

$ tree
├── get-requests.http
├── http-client.env.json
├── http-client.private.env.json
├── post-requests.http
├── request-form-data.json
├── requests-with-authorization.http
├── requests-with-tests.http
└── test_script.js

$ java -jar /path/to/restcli.jar -e "test" get-requests.http

Note: This application required you to install java on your machine.

Download

You can download the latest version of restcli for Windows, macOS, and Linux.

Credits

This software uses the following open-source packages:

  • Jflex - a lexical analyzer generator (also known as scanner generator) for Java.
  • PicoCli - a mighty tiny command line interface
  • okhttp - the way modern applications network. It’s how we exchange data & media. Doing HTTP efficiently makes your stuff load faster and saves bandwidth.
  • picnic - A Kotlin DSL and Java/Kotlin builder API for constructing HTML-like tables that can be rendered to text.
  • mordant - Full-featured text styling for Kotlin command-line applications.

Thanks Jetbrains for a free license

JetBrains Logo (Main) logo.

Support

If you need help, please don't hesitate to file an issue.

Sponsoring

This application is free and can be used for free, open-source, and commercial applications. restcli is under the MIT License (MIT). So hit the magic ⭐ button; I appreciate it!!! 🙏

🤝 Contributing

I appreciate your support and feedback!

Please file issues if you find bugs and have feature requests. If you can send small PRs to improve or fix bugs, that would be awesome too.

For larger PRs, please ping @quangson91 to discuss first.

📝 License

MIT License

Copyright (c) 2020 Duong Quang Son

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the software, and to permit persons to whom the software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Made with by quangson91

restcli.github.io  ·  GitHub @quangson91  ·  Twitter @quangson91

Reference

  • restcli-node Node docker image with rest-cli command installed.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Martin Qvistgård

📓

Robert Jack Will

🤔

gsobczyk

💻

Vlad

📓

Nicolas Peters

💻

xargon180

💻

Hannes U.

💻

sbenoistmics

💻

Kwangsu Kim

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

restcli's People

Contributors

allcontributors[bot] avatar asm0dey avatar cylonid avatar gsobczyk avatar kakao-kit-t avatar konikvranik avatar npeters avatar pay-snow-y avatar pil0t avatar quangson91 avatar sbenoistmics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

restcli's Issues

Node docker image for CI build

Hello there,

I discovered the project this W.E. First of all, thank you for everything!

I am developing api in NodeJS. To test it I need to run restcli in a gitlab CI.
That's why I propose this docker image : restcli-node

Is base on a "node" image, with the openjdk installed, and a command to execute "restcli" (rest-cli).

I'm open to your suggestions, modifications, or simply to your critics.

More on github

(A javascript version of the code as proposed on #35 would allow to only have to install the package, without having to go through all that)

With pleasure
J4Y

pass variables via command line

Thanks for making this tool! I have waited for it many months!

Since the recommendation for environment files is to not commit the private one into source control, this file will not be available when running tests on a CI server.

Possible solutions:

  • somehow create that file in a script to be run before the test, which pulls the secrets from a secret store. (Creating the file with just the one environment entry to be run would be sufficient, but that's still some extra syntax to wrap around the secrets. So I am looking for a simpler way.)
  • pass the secrets via command line to the runner (Command line may get long, when there are many secrets, but that's usually not the case.)
  • pass the secrets via environment variables to the runner (can lead to very unexpected behavior when a variable in the .http file is overwritten by an env variable whose existence one wasn't aware of!)

In Gitlab CI, for example, secrets can be made available via environment variables. Then could then be passed to the tests like this:
java -jar restcli.jar -Dapi-password=$API_PASSWORD my-api-test.http

An additional advantage of this method is that also non-private variables can be set without having to modify the http-client.env.json file.

((I proposed the -D parameter here in analogy to passing Java System properties, so it's easy to remember. Although it might also be confusing. So maybe -G (for global variable) or -P (for private variable) should be used instead.))

As a bonus requirement, it would be awesome, if private variables would be omitted from any reports. ;-)

What do you think about it?

Incorrect special/table characters in Windows Terminal

Using Windows Terminal the output of restcli contained question mark characters (when using Command Prompt) or visible escape sequences (when using Bash Shell) instead of check marks and table drawing characters, e.g.

TESTS:
? OK Test
Content-Type header: application/json;charset=UTF-8
? Content Type (JSON) Test

__________________________________________________

[START] Creating test report: session-tests
[FINISHED]
????????????????????
?TOTAL REQUESTS: 42?
????????????????????
?????????????
?TEST RESULT?
?????????????
?Total: 41  ?
?Passed: 41 ?
?Failed: 0  ?
?????????????

or

TESTS:
←[32m? OK Test←[0m
Content-Type header: application/json;charset=UTF-8
←[32m? Content Type (JSON) Test←[0m

Additionally, Command Prompt (inside Windows Terminal) was able to display the green/red colors, but Bash Shell wasn't.

It appears that the standard Command Prompt application also has difficultly with these characters.

This is undoubtedly a terminal-related problem, but are there any options to disable special characters/colors? Or do you have any suggestions for setting TERM to an appropriate value?

Improve the error handling

In some network error or execution error are not add to TestReportStore and the process exit on 0.

It should be great to report the error and exit with an error code.

The problem should come from onFailure block.

Support full JS in test scripts

Without being able to reuse existing JS packages and reuse test scripts, the tests will quickly become very repetitive. I would like to write a test using anything node has at its disposal.

// test.js
import { parse } from 'some-npm-package'
import { responseOk } from './test-helper.js'

// is async supported by the way?
client.test('rich test', async () => {
  const parsed = await parse(response.body)

  client.test(parsed.something.length === 101, 'Incorrect number of results')
})

// reuse assertion function in many tests
client.test('Response is 200', responseOk)

The test-helper.js script could be something like

// because I do not want to repeat that assertion
export function responseOk(client, response) {
    client.assert(response.status === 200, 'Response was not successful')
}

This way would be possible to write more concise and idiomatic tests


Currently, when I tried import or require the script does not even parse and throws an error

:1:0 Expected an operand but found const
const $rdf = require('rdf-ext')
^ in at line number 1 at column number 0

Here's a GraalVM example, which might be helpful. Rather than a simple eval, a context is created which should allow importing scripts and package. The latter is not show as example but implied on the linked page

[Bug] Test results format incompatible with bitbucket pipelines

I used restcli to execute tests as part of bitbucket pipeline, and found that bitbucket didn't understand results correctly.
I created request to support, and they respond me:

Test report being generated as the following:


<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" name="IntelliJ Rest CLI - Test Generator">
<testsuite tests="1" name="https://bitbucket.org/"><testcase name="Request executed successfully"/>
</testsuite><testsuite tests="1" name="https://api.bitbucket.org/notexist">                <testcase name="Request executed successfully">
                    <failure type="AssertionFailure">Response status is not 200
File: example.http
Line: 14</failure>
                </testcase>
</testsuite></testsuites>

To get it working, format should be adjusted to:


<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" name="IntelliJ Rest CLI - Test Generator">
	<testsuite tests="1" name="https://bitbucket.org/" errors="0" failures="0" skip="0">
		<testcase classname="Test" name="Request executed successfully" time="0">
		</testcase>
	</testsuite>
	<testsuite tests="1" name="https://api.bitbucket.org/notexist" errors="0" failures="1" skip="0">
		<testcase classname="Test" name="Request executed successfully" time="0">
			<failure type="AssertionFailure" message="Response status is not 200">
			File: example.http
			Line: 14
			</failure>
		</testcase>
	</testsuite>
</testsuites>

We suspect that your reporting tool is not following the X-Unit / J-Unit format, because as you can see certain parameters are missing.

Wrong parameter substitution in url

I have request in .http file with URL defined as:
GET {{host}}/v1/people?$filter=groupId eq+ {{groupId}}
in Rider (similar HTTP Client) I can see in the output real URL as:
GET http://localhost/v1/people?%24filter=groupId+eq+bad0680d-4f5b-4739-8739-3233bd8ef8fa
In the restcli I can see next:

--> GET http://bad0680d-4f5b-4739-8739-3233bd8ef8fa/
--> END GET```

Trace information for failed tests

Hi! This tool is getting better and better by the day!

When a test fails, it would be nice if you could write e.g. file and line to the junit report to make it easier to identify where the failure occurred. This is what you get from PHPUnit - something similar would be nice.

CleanShot 2020-08-18 at 15 04 29@2x

At least for Gitlab, all JUnit files will be integrated into the same display, so having the file name in the error text is still useful.

SSL handshake error even with -k

We run

restcli -k -d=.. -e=dev some-requests.http

and get, among other output, one of these per request:

<-- HTTP FAILED: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

[Bug] Uploading binary files in wrong format

Tested on https://upload.wikimedia.org/wikipedia/commons/c/ce/Transparent.gif

Example code for testing:

PUT https://httpbin.org/put

< ./Transparent.gif

> {%
  client.log(response);
%}

Running from Rider (IDE) I have the next response:

...
"data": "data:application/octet-stream;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
...

But if run from restcli :

...
  "data": "GIF89a\u0001\u0000\u0001\u0000\ufffd\u0000\u0000\u0000\u0000\u0000\ufffd\ufffd\ufffd!\ufffd\u0004\u0001\u0000\u0000\u0000\u0000,\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0000\u0002\u0001D\u0000;",
...

Running RestCli from an application server

Hello, I'm trying to use RestCli like this:

    final String[] testen = {"http-client/fubar.http"};
    final RestCli restCli = new RestCli();
    restCli.setEnvironmentFilesDirectory("http-client");
    restCli.setEnvironmentName("foobar");
    restCli.setHttpFilePaths(testen);
    final int result = restCli.call();
    assertEquals(0, result);

Which works. But how do I get access to the results?

The test-reports folder gets created in the bin folder of WildFly. That is hardly a place I can reasonably access. Is there a way to change where the test-reports go? Or to access them the results of the tests in a different way?

Would be nice if somebody can tell me how to this.

CU Hans

Preserve variables between files

When I set variable in first request and use it in the same file it works. But if I set variable in one file and use it in another it doesn't work. In IntelliJ Http Client it works.

Example with one file (works in IntelliJ HTTP Client and also in REST CLI)

example.http:

### Test a
GET https://httpbin.org/uuid

> {%
client.test("Request executed successfully", function() {
  client.log("response body: " + response.body.uuid);
  client.global.set("my_variable", response.body.uuid);
});
%}

### Test b
GET https://httpbin.org/get?show={{my_variable}}

> {%
client.test("Request executed successfully", function() {
  client.log("my_variable: " + client.global.get("my_variable"));
});
%}

IntelliJ:

First request:

image

Second request:

image

image

REST CLI:

java -jar restcli.jar example.http

First request:

image

Second request:

image

Example with two files (works in IntelliJ HTTP Client but doesn't work in REST CLI)

example1.http:

### Test a
GET https://httpbin.org/uuid

> {%
client.test("Request executed successfully", function() {
  client.log("response body: " + response.body.uuid);
  client.global.set("my_variable", response.body.uuid);
});
%}

example2.http:

### Test b
GET https://httpbin.org/get?show={{my_variable}}

> {%
client.test("Request executed successfully", function() {
  client.log("my_variable: " + client.global.get("my_variable"));
});
%}

IntelliJ:

First request:

image

Second request:

image

image

REST CLI:

java -jar restcli.jar example1.http
java -jar restcli.jar example2.http

First request:

image

Second request:

image

You can see that variable isn't existed:

WARNING: Define my_variable but there is no define in environment

"{{my_variable}}"

my_variable: undefined

I know these are two separated invoking REST CLI. But how to share variables between them like in IntelliJ HTTP Client? Maybe there is a way to run two files at once or configure temp file to preserve variables?

Test breaking request for POST Content-Type: application/x-www-form-urlencoded

Hello,

sdfsdf
I am having an issue running the following use case from your tests:

The following exxemple is working fine

POST https://httpbin.org/post
Content-Type: application/x-www-form-urlencoded

id=999&value=content

But if i add some javascript to make a test or set a global variable it fails. Seems like the parsing is not going well here:

POST https://httpbin.org/post
Content-Type: application/x-www-form-urlencoded

id=999&value=content

> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "wrong status: " + client.status);
});
%}

[Feature request] Timeout configuration

Seems, right now it's not possible to configure extended timeouts for requests.

Consider adding startup option:

-t, --timeout=<milliseconds> Number of milliseconds for request timeout, default=3000

Suggestion: Use default request body if request body is null when POST, PUT, PATCH...

Hello there,

First of all
I'm using this library well in my project. Thank you!!.

I found an issue that it doesn't allow empty request body except GET

### Send request with no request's body
POST https://httpbin.org/post

> {%
  client.test("Response is ok", function() {
    client.assert(response.status === 200, "Response status is not ok");
  });
%}

Perhaps this is the effect of the OkHttpRequest library.

However it doesn't matter in IntelliJ, and it works well.

How about using default request body if request doesn't have a request body when http method is post, put, patch..

// example
private fun getRequestBody(request: Request): RequestBody? {
        val body = request.body?.toRequestBody() ?: request.createMultipartRequestBody()

        if (HttpMethod.requiresRequestBody(request.method.name) && body == null) {
            return "{}".toRequestBody()
        }

        return body
}

so if you don't mind i can raise a PR soon

with pleasure

Possible bug with response.headers.Valueof

First off, huge thanks for implementing a cli runner for http test files! This will be so useful! 💯

I have started to experiment a bit and i think I ran into a problem with response.headers.valueOf.

I have written a test .http file like this:

POST http://127.0.0.1:81/en/api/auth/login
Content-Type: application/json;charset=UTF-8
Accept: application/json
Cookie: XDEBUG_SESSION=docker

{"username":"xxxx","password":"qwerty"}

> {%
client.test("That request was successful", function() {
    client.assert(response.status === 200, "Response status is not 200");
});

client.test("That Authorization token was returned", function() {
    client.assert(response.headers.valueOf('Authorization') != null);
});

client.test("That there is a value for the auth token", function() {
    client.assert(false, 'token is ' + response.headers.valueOf('Authorization'));
});

%}

This is my output from Php Storm (a bit truncated)
image

However, when I run the same script i get the following output:

>>> Test script >>>
✓ That request was successful
✓ That Authorization token was returned
✗ That there is a value for the auth token
token is [object Object]
<<< Test script <<<

Result file(.xml) Information

I wonder the result file (. xml )
I have two questions.

First, I can't see the url method in the result file. Is the method not displayed usually?
And the next question is that if I didn't write assertion in test script(.http client ) , The url is not displayed in the result file.
If there is no assertion, does the url not appear in the result file?

after rest-cli execution, can I get another result file?
The current result file lacks content..

Java script for set variable doesn't work

All of my services working with JWT token and I using a first login api call for getting JWT token and after that I using JS code for set JWT token for next api calls. but it doesn't work here.
`
#Step #1 Longin by Tenant Admin
POST {{schema}}{{host}}/api/auth/login
Content-Type: application/json

{
"username": "{{username}}",
"password": "{{password}}"
}

{%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
var objJson = JSON.stringify(response.body);
var json = JSON.parse(objJson);
var jwt_token = json.token;
var refreshToken = json.refreshToken;
var mfa_token = json.mfaToken;
client.global.set("jwt_token",jwt_token);
client.global.set("mfa_token",mfa_token);
client.global.set("refreshToken",refreshToken);
client.log(jwt_token);
});
%}

POST {{schema}}{{host}}/api/connectivity/createTriggerPackage/company/63000032?name=TEEEST11&description=TEEESTDESC
X-Authorization: Bearer {{jwt_token}}
Content-Type: application/json

{
"triggerMetric": [
{
"actionActive": false,
"actionValue": "1",
"alertActive": true,
"alertValue": 1,
"timeFrame": "1",
"triggerName": "TEEEST11",
"triggerNumber": "10"
}
]
}
`
this commands work in intellij idea Http client but didn't work on restcli

Question: Reuse requests

Hi.

Is there a way one could reuse a file, containing common requests (say authentication, clean up...), to avoid duplicating requests all over files?

Thank you.

When running restcli with multiple .http files as input the exit code returned is success in the event that a test failed

Steps to reproduce:

  1. Create a http file with a failing test (failing-test.http)
  2. Create a http file with a successful test (success-test.http)
  3. Excecute java -jar restcli.jar failing-test.http success-test.http or java -jar restcli.jar /*.http

Results:

  • if the last executed http file is successful but the first ones failed, restcli exit code is 0

Expected:

  • If any of the .http files tests failed no matter in what order, restcli should exit with code 1.

Proposed PR: #106

--report adds datestamp which causes problems with gitlab ci

Adding --report="api-report" results in a file named someting like 202008050909_api-report.xml

At least in gitlab ci this causes a problem. report files has to be specified like this:

script:
    - java -jar /restcli.jar -s `pwd`/v2/module/PartnerOrder/test/HTTP/WorkflowTest.http -l=NONE -r=api-report.xml
artifacts:
  paths:
    - api-report.xml
  reports:
    junit: api-report.xml

Since a timestamp is added to the specified filename gitlab can not find the report file

Uploading artifacts for successful job
Uploading artifacts...
WARNING: api-report.xml: no matching files         
ERROR: No files to upload 

NullPointerException when environment is only defined in private file

I have a dev environment set up in http-client.env.json

{
  "dev": { 
    "foo": "bar"
  }
}

Locally, I wanted to try something out against a remote env so I created a http-client.private.env.json with

{
  "preview": { 
    "foo": "baz"
  }
}

When I ran restcli -e foo I get an exception

┌────────────────────────┐
│restcli                 │
├────────────────┬───────┤
│Environment name│preview│
└────────────────┴───────┘
java.lang.NullPointerException
        at uos.dev.restcli.EnvironmentLoader.loadConfig(EnvironmentLoader.kt:42)
        at uos.dev.restcli.EnvironmentLoader.load(EnvironmentLoader.kt:17)
        at uos.dev.restcli.HttpRequestFilesExecutor.run(HttpRequestFilesExecutor.kt:43)
        at uos.dev.restcli.RestCli.call(RestCli.kt:85)
        at uos.dev.restcli.RestCli.call(RestCli.kt:12)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at uos.dev.restcli.AppKt.main(App.kt:9)

It is not throws if I add an empty environment key to the public env file

{
  "dev": { 
    "foo": "bar"
- }
+ },
+ "preview": {}
}

Internal GraalVM error when running

I downloaded the latest jar from releases (v2.0.1).
I run my test with:

java -jar restcli.jar -d test -e dev test/queries/*.http

The result is this:

┌────────────────────┐
│restcli             │
├────────────────┬───┤
│Environment name│dev│
└────────────────┴───┘
[To redirect Truffle log output to a file use one of the following options:
* '--log.file=<path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.]
[engine] WARNING: The polyglot context is using an implementation that does not support runtime compilation.
The guest application code will therefore be executed in interpreted mode only.
Execution only in interpreted mode will strongly impact the guest application performance.
For more information on using GraalVM see https://www.graalvm.org/java/quickstart/.
To disable this warning the '--engine.WarnInterpreterOnly=false' option or use the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.
org.graalvm.polyglot.PolyglotException: java.lang.IllegalStateException: No language for id regex found. Supported languages are: [js]
    at com.oracle.truffle.polyglot.PolyglotEngineException.illegalState(PolyglotEngineException.java:129)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.findLanguage(PolyglotEngineImpl.java:722)
    at com.oracle.truffle.polyglot.EngineAccessor$EngineImpl.parseForLanguage(EngineAccessor.java:244)
    at com.oracle.truffle.api.TruffleLanguage$Env.parseInternal(TruffleLanguage.java:2486)
    at com.oracle.truffle.js.runtime.builtins.JSRegExp.es5GetEmptyRegexEarly(JSRegExp.java:358)
    at com.oracle.truffle.js.runtime.builtins.JSRegExp.createPrototype(JSRegExp.java:325)
    at com.oracle.truffle.js.runtime.builtins.JSConstructorFactory$Default.createConstructorAndPrototype(JSConstructorFactory.java:68)
    at com.oracle.truffle.js.runtime.builtins.JSRegExp.createConstructor(JSRegExp.java:377)
    at com.oracle.truffle.js.runtime.JSRealm.<init>(JSRealm.java:511)
    at com.oracle.truffle.js.runtime.JSContext.createRealm(JSContext.java:664)
    at com.oracle.truffle.js.lang.JavaScriptLanguage.createContext(JavaScriptLanguage.java:307)
    at com.oracle.truffle.js.lang.JavaScriptLanguage.createContext(JavaScriptLanguage.java:115)
    at com.oracle.truffle.api.LanguageAccessor$LanguageImpl.createEnvContext(LanguageAccessor.java:282)
    at com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureCreated(PolyglotLanguageContext.java:541)
    at com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureCreated(PolyglotLanguageContext.java:485)
    at com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureInitialized(PolyglotLanguageContext.java:627)
    at com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:1346)
    at com.oracle.truffle.polyglot.PolyglotContextDispatch.eval(PolyglotContextDispatch.java:62)
    at org.graalvm.polyglot.Context.eval(Context.java:375)
    at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.evalInternal(GraalJSScriptEngine.java:376)
    at com.oracle.truffle.js.scriptengine.GraalJSBindings.initGlobal(GraalJSBindings.java:94)
    at com.oracle.truffle.js.scriptengine.GraalJSBindings.initContext(GraalJSBindings.java:90)
    at com.oracle.truffle.js.scriptengine.GraalJSBindings.requireContext(GraalJSBindings.java:84)
    at com.oracle.truffle.js.scriptengine.GraalJSBindings.entrySet(GraalJSBindings.java:170)
    at java.base/java.util.AbstractMap.containsKey(AbstractMap.java:144)
    at java.scripting/javax.script.SimpleScriptContext.getAttribute(SimpleScriptContext.java:158)
    at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.createSource(GraalJSScriptEngine.java:430)
    at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:400)
    at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
    at uos.dev.restcli.jsbridge.JsClient.<init>(JsClient.kt:22)
    at uos.dev.restcli.jsbridge.JsClient.<init>(JsClient.kt:15)
    at uos.dev.restcli.jsbridge.JsClient.<init>(JsClient.kt:16)
    at uos.dev.restcli.HttpRequestFilesExecutor.<init>(HttpRequestFilesExecutor.kt:31)
    at uos.dev.restcli.RestCli.call(RestCli.kt:73)
    at uos.dev.restcli.RestCli.call(RestCli.kt:12)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
    at picocli.CommandLine.access$1300(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
    at picocli.CommandLine.execute(CommandLine.java:2078)
    at uos.dev.restcli.AppKt.main(App.kt:9)
Caused by: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.

I run macOS Catalina. Here's the output of java --version:

java 16.0.2 2021-07-20
Java(TM) SE Runtime Environment (build 16.0.2+7-67)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)

The tests works fine when running with Java8 using the latest version from brew (v1.7.4)

Create an executor using node/javascript

By using node/javascript executor we can easily remove the dependency of nashorn engine.
Also, we can using latest feature of the new javascript version.

Intent:

  • restcli: For parser
  • easy to create custom executor in other languages(currently the executor is using nashron engine).

hostnames from /etc/hosts seems to not be honored

It seems that hostnames from /etc/hosts is not honored by rest-cli.

This can be a problem in environments with docker and especially in more complex ci setups where docker in docker is used.

With this test script:

// POST http://127.0.0.1:8081/en/api/auth/login
POST http://docker.local:8081/en/api/auth/login
Content-Type: application/json;charset=UTF-8
Accept: application/json

{"username":"xxxx","password":"qwerty"}

> {%
client.test("That request was successful", function() {
    client.assert(response.status === 200, "Response status is not 200");
});

And this line in my /etc/hosts file
127.0.0.1 docker.local

I get this result from php storm
image

With rest-cli this is what I get:

Environment name: null; Script: /home/martin//test/HTTP/WorkflowTest.http
__________________________________________________

##### Execute request http://docker.local:8081/en/api/auth/login #####
Can't execute request target: http://docker.local:8081/en/api/auth/login
java.lang.UnsupportedOperationException: Can't execute request target: http://docker.local:8081/en/api/auth/login                                             
        at uos.dev.restcli.executor.OkhttpRequestExecutor.execute(OkhttpRequestExecutor.kt:35)                                                                              
        at uos.dev.restcli.RestCli$call$$inlined$forEach$lambda$1.invoke(RestCli.kt:79)
        at uos.dev.restcli.RestCli$call$$inlined$forEach$lambda$1.invoke(RestCli.kt:26)
        at uos.dev.restcli.RestCli.runSafe(RestCli.kt:130)
        at uos.dev.restcli.RestCli.call(RestCli.kt:74)
        at uos.dev.restcli.RestCli.call(RestCli.kt:26)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1853)
        at picocli.CommandLine.access$1100(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2255)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2249)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2213)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2080)
        at picocli.CommandLine.execute(CommandLine.java:1978)
        at uos.dev.restcli.AppKt.main(App.kt:7)


getEngineByName("nashorn") must not be null

Hello,

I have been trying to dockerize your CLI tool.
Here is the dockerfile content:
FROM openjdk:latest WORKDIR Home COPY restcli.jar . COPY Usecases ./Usecases

I push the version 1.7.3 of the CLI tool into it.

i run this command to execute tests:

java -jar ../restcli.jar -e "dev" Testusecase.http

Here is the stack trace of the error:

java.lang.IllegalStateException: ScriptEngineManager().getEngineByName("nashorn") must not be null at uos.dev.restcli.jsbridge.JsClient.<init>(JsClient.kt:18) at uos.dev.restcli.HttpRequestFilesExecutor.<init>(HttpRequestFilesExecutor.kt:24) at uos.dev.restcli.RestCli.call(RestCli.kt:59) at uos.dev.restcli.RestCli.call(RestCli.kt:16) at picocli.CommandLine.executeUserObject(CommandLine.java:1853) at picocli.CommandLine.access$1100(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2255) at picocli.CommandLine$RunLast.handle(CommandLine.java:2249) at picocli.CommandLine$RunLast.handle(CommandLine.java:2213) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2080) at picocli.CommandLine.execute(CommandLine.java:1978) at uos.dev.restcli.AppKt.main(App.kt:9)

running java -version ouput:
java -version openjdk version "15.0.1" 2020-10-20 OpenJDK Runtime Environment (build 15.0.1+9-18) OpenJDK 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)

Any idea how to fix this ?

Valid JSON response, but getting syntax error when gzipped body

java -jar ~/Téléchargements/restcli.jar 1.http
...
"valid JSON"
<-- END HTTP (626-byte, 449-gzipped-byte body)

...
SyntaxError: Invalid JSON: <json>:1:0 Expected json literal but found 
[bunch of gibberish characters ^^]
^ in <eval> at line number 1

If I remove Accept-Encoding: gzip, deflate, br there's no longer this syntax error

Btw, how could the JSON response be pretty-print instead of inline ?....

Problems with test report output

Hi!

Thank you for all your hard work!
I just tested version 1.4, having the ability to supply a list of .http files is awesome and what really makes this a killer app for ci workflows 👍

I did find some a couple of issues during testing, though.

When running more than one .http file, there are no results at all in the file specified by -r argument. Instead the results are output in the test-reports folder in files with the same name as the .http file. This makes it hard to integrate with gitlab ci, which as far as I know does not support wildcards for finding report files. The results should, as I see it, all be collected in the file specified by -f.

In case this is the planned behavior, there is a problem with files overwriting each other. In our case, we have several modules in our application and they each have a folder test/HTTP that usually contains a file named ApiTests.http. In this scenario, the report file from the last ApiTests.http file to run will overwrite earlier reports.

Publishing Artifact to Maven Central

It would be nice if restcli be available from maven as jvm library.

Then you would be able to run requests test directly from JUnit, such as:

class MyApiTest {

    @ParameterizedTest
    @CsvSource(value = [
        "1. simple tests.http",
        "2. complex tests.http"
    ])
    fun `should successfully execute test requests`(fileName: String) {
        // Given
        println("Test file: $fileName")
        val restCli = RestCli().apply {
            environmentName = "test"
            httpFilePaths = arrayOf(javaClass.getResource("/requests/${fileName}").path)
            environmentFilesDirectory = javaClass.getResource("/requests/").path
        }
        // When
        val exitCode = restCli.call()
        // Then
        assertThat(exitCode).isEqualTo(0)
    }
}

Asynchronous Processing

Hi,

First of all, this project is awesome; it makes API testing very easy to manage. We discovered it recently but are getting very fond of it.

I am not sure if what I ask needs to be supported by the IntelliJ HTTP client or can be supported by restcli.

We are running API tests in a suite that would mimic a user flow. In between some requests, our services are communicating to each other asynchronously via message queues. For example:

  • we hit an API on service A
  • service A publishes a message
  • service B consumes and processes the message
  • we hit an API on service B

We need to be able to introduce some delay between requests so that the message has time to arrive from service A to service B and service B to process the message. Otherwise, our assertions on service B will fail. Alternatively, being able to continuously call the API on service B until the assertion passes (or some timeout occurs) would also help.

Many thanks :)

Build docker image for rest-cli

Create a docker image with support rest cli by default.

Eg: Make an alias in docker image. So instead call java -jar rest-cli.jar
we just need restcli .... arguments ....

Sugestion: Gradle Plugin

Is it possible to have a Gradle plugin with this? Would be great so it's easier to integrate with projects.

Hide binary input

Current behavior:
When uploading a file the binary of that file will be printed to stdout.

Expected behavior:
Like on the download example, the binary input should be omitted.

Steps to reproduce:

GET https://restcli.github.io/img/logo.png

> {%
    client.test("Request executed successfully", function() {
        client.assert(response.status === 200, "Response status is not 200");
    });

    client.test("Response content-type is image/png", function() {
        var type = response.contentType.mimeType;
        client.assert(type === "image/png", "Expected 'image/png' but received '" + type + "'");
    });
    client.global.set("file", response.body);
%}
###

POST https://httpbin.org/get
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryIXLEm4ZXwxvTBdUn

------WebKitFormBoundaryIXLEm4ZXwxvTBdUn
Content-Disposition: form-data; name="filename"

logo.png

------WebKitFormBoundaryIXLEm4ZXwxvTBdUn
Content-Disposition: form-data; name="file"; filename="release.apk"
Content-Type: image/png

{{file}}
------WebKitFormBoundaryIXLEm4ZXwxvTBdUn--

> {%
    client.test("Request not allowed", function() {
        client.assert(response.status === 405, "Response status is not 405");
    });
%}

Use actual environment variables

We run restcli in CI and the -G switch becomes quite verbose. The only alternative is to create a JSON file with variables, which is just a little awkward.

Now, since the variables are in the runtime environment anyway, it would be nice if restcli would first try to use those.

# set in CI
export ENDPOINT=http://example.com

# make this opt-in?
java -jar restcli.jar --vars-from-env test/archive/*.http

Passing --vars-from-env would be equivalent to adding -G ENDPOINT="${ENDPOINT}"

Test post-requests.http throw a FileNotFoundException

`
HTTP REQUEST FILE: /Users/npeters/workspaces/github/restcli/build/resources/test/requests/post-requests.http
Can't parse /Users/npeters/workspaces/github/restcli/build/resources/test/requests/post-requests.http
java.io.FileNotFoundException: ./request-form-data.json (No such file or directory)
at java.io.FileInputStream.open0(Native Method) ~[?:?]
at java.io.FileInputStream.open(FileInputStream.java:219) ~[?:?]
at java.io.FileInputStream.(FileInputStream.java:157) ~[?:?]
at kotlin.io.FilesKt__FileReadWriteKt.readText(FileReadWrite.kt:125) ~[kotlin-stdlib-1.4.0.jar:1.4.0-release-329 (1.4.0)]
at kotlin.io.FilesKt__FileReadWriteKt.readText$default(FileReadWrite.kt:125) ~[kotlin-stdlib-1.4.0.jar:1.4.0-release-329 (1.4.0)]
at uos.dev.restcli.parser.Parser.parse(Parser.kt:64) ~[main/:?]
at uos.dev.restcli.HttpRequestFilesExecutor.executeHttpRequestFile(HttpRequestFilesExecutor.kt:73) ~[main/:?]
at uos.dev.restcli.HttpRequestFilesExecutor.run(HttpRequestFilesExecutor.kt:46) ~[main/:?]
at uos.dev.restcli.RestCli.call(RestCli.kt:88) ~[main/:?]

`
The application use current dir as a basedir.
It should used the request file's directory as a basedir.

Bug with varible replacement via {{var}}

There seems to be a problem with variable replacement via {{var}}, at least for variables that are defined by response handler scripts.

Test script as below:

POST http://127.0.0.1:81/en/api/auth/login
Content-Type: application/json;charset=UTF-8
Accept: application/json

{"username":"xxxx","password":"qwerty"}

> {%
client.test("That there is a value for the auth token", function() {
    client.assert(false, 'token is ' + response.headers.valueOf('Authorization'));
});

client.global.set("auth_token", response.headers.valueOf('Authorization'));
%}

###

GET http://127.0.0.1:81/en/api/auth/config
Content-Type: application/json;charset=UTF-8
Accept: application/json
Authorization: {{auth_token}}

> {%
client.test("That logged in user gets information", function() {
    client.assert(response.body.isLoggedIn === true, "User is not logged in, despite supplying auth token");
});

client.test("That auth_token still has a value", function() {
    client.assert(false, client.global.get('auth_token'));
});
%}

This is my output from the second test in php storm
image

This is the output from cli-runner:

WARNING: Define auth_token but there is no define in environment                      
                                                                                      
__________________________________________________                                    
                                                                                      
##### Execute request http://127.0.0.1:81/en/api/auth/login #####       
>>> Test script >>>                                                                   
✓ That request was successful                                                         
✓ That Authorization token was returned
✗ That there is a value for the auth token
token is Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
<<< Test script <<<

__________________________________________________

##### Execute request http://127.0.0.1:81/en/api/auth/config #####
>>> Test script >>>
✗ That logged in user gets information
User is not logged in, despite supplying auth token
✗ That auth_token still has a value
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
<<< Test script <<<

As you can see, cli-runner trows a warning about auth_token and also the authorization fails.
Running cli-runner with full logs gives this line

Aug 04, 2020 8:42:57 AM uos.dev.restcli.executor.OkhttpRequestExecutor$CustomLogger log 
INFO: Authorization: {{auth_token}}     

nodename nor servname provided, or not known

Hi!

Trying to run our file auth.http:

java -jar restcli.jar -e "development" auth.http

Exception:

[SKIP TEST] Because: lvapitest.localhost.wip: nodename nor servname provided, or not known

I think the problem is our proxy. We have set the proxy configuration at the system level (MacOs Big Sur) to:

automatic proxy configuration
proxy configuration file: http://127.0.0.1:7080/proxy.pac

I tried the following solution, which works with cUrl (https://symfony.com/doc/current/setup/symfony_server.html#local-domain-names). But no success:

https_proxy=http://127.0.0.1:7080 java -jar /usr/local/bin/restcli.jar --env="development" auth.http

Is it possible to add the proxy configuration to the command line arguments?

Regards, Stijn


(base) ➜  httpClient git:(develop) ✗ java -jar restcli.jar -e "development" auth.http -k
┌────────────────────────────┐
│restcli                     │
├────────────────┬───────────┤
│Environment name│development│
└────────────────┴───────────┘

__________________________________________________

HTTP REQUEST FILE: auth.http

__________________________________________________

##### POST ***************h***************t***************t***************p***************s***************:***************/***************/***************l***************v***************a***************p***************i***************t***************e***************s***************t***************.***************l***************o***************c***************a***************l***************h***************o***************s***************t***************.***************w***************i***************p***************/***************a***************p***************i***************/***************o***************a***************u***************t***************h***************/***************v***************2***************/***************t***************o***************k***************e***************n*************** #####
***************-***************-***************>*************** ***************P***************O***************S***************T*************** ***************h***************t***************t***************p***************s***************:***************/***************/***************l***************v***************a***************p***************i***************t***************e***************s***************t***************.***************l***************o***************c***************a***************l***************h***************o***************s***************t***************.***************w***************i***************p***************/***************a***************p***************i***************/***************o***************a***************u***************t***************h***************/***************v***************2***************/***************t***************o***************k***************e***************n***************
***************C***************o***************n***************t***************e***************n***************t***************-***************L***************e***************n***************g***************t***************h***************:*************** ***************2***************4***************6***************
***************C***************o***************n***************t***************e***************n***************t***************-***************T***************y***************p***************e***************:*************** ***************a***************p***************p***************l***************i***************c***************a***************t***************i***************o***************n***************/***************j***************s***************o***************n***************
***************
***************{***************
*************** *************** *************** *************** ***************"***************g***************r***************a***************n***************t***************_***************t***************y***************p***************e***************"***************:*************** ***************"***************p***************a***************s***************s***************w***************o***************r***************d***************"***************,***************
*************** *************** *************** *************** ***************"***************c***************l***************i***************e***************n***************t***************_***************i***************d***************"***************:*************** ***************"***************************************************************"***************,***************
*************** *************** *************** *************** ***************"***************c***************l***************i***************e***************n***************t***************_***************s***************e***************c***************r***************e***************t***************"***************:*************** ***************"***************************************************************"***************,***************
*************** *************** *************** *************** ***************"***************u***************s***************e***************r***************n***************a***************m***************e***************"***************:*************** ***************"***************************************************************"***************,***************
*************** *************** *************** *************** ***************"***************p***************a***************s***************s***************w***************o***************r***************d***************"***************:*************** ***************"***************************************************************"***************
***************}***************
***************-***************-***************>*************** ***************E***************N***************D*************** ***************P***************O***************S***************T*************** ***************(***************2***************4***************6***************-***************b***************y***************t***************e*************** ***************b***************o***************d***************y***************)***************
***************<***************-***************-*************** ***************H***************T***************T***************P*************** ***************F***************A***************I***************L***************E***************D***************:*************** ***************j***************a***************v***************a***************.***************n***************e***************t***************.***************U***************n***************k***************n***************o***************w***************n***************H***************o***************s***************t***************E***************x***************c***************e***************p***************t***************i***************o***************n***************:*************** ***************l***************v***************a***************p***************i***************t***************e***************s***************t***************.***************l***************o***************c***************a***************l***************h***************o***************s***************t***************.***************w***************i***************p***************:*************** ***************n***************o***************d***************e***************n***************a***************m***************e*************** ***************n***************o***************r*************** ***************s***************e***************r***************v***************n***************a***************m***************e*************** ***************p***************r***************o***************v***************i***************d***************e***************d***************,*************** ***************o***************r*************** ***************n***************o***************t*************** ***************k***************n***************o***************w***************n***************
[SKIP TEST] Because: lvapitest.localhost.wip: nodename nor servname provided, or not known

__________________________________________________

[START] Creating test report: auth
[FINISHED]
┌─────────────────┐
│TOTAL REQUESTS: 1│
└─────────────────┘
┌───────────┐
│TEST RESULT│
├───────────┤
│Total: 1   │
│Passed: 0  │
│Failed: 1  │
└───────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│#                                                                                                                                                                                                 │name                                                                                                                                                                                                 │failure                                                                                                                                                                                                          │detail                                                                                                                                                                                                                        │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│[REQUEST] ***************h***************t***************t***************p***************s***************:***************/***************/***************l***************v***************a***************p***************i***************t***************e***************s***************t***************.***************l***************o***************c***************a***************l***************h***************o***************s***************t***************.***************w***************i***************p***************/***************a***************p***************i***************/***************o***************a***************u***************t***************h***************/***************v***************2***************/***************t***************o***************k***************e***************n***************│
│[FILE] auth.http                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         │
│[LINE] near 13                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│1                                                                                                                                                                                                 │Http                                                                                                                                                                                                 │lvapitest.localh                                                                                                                                                                                                 │lvapitest.localhost.wip: noden                                                                                                                                                                                                │
│                                                                                                                                                                                                  │                                                                                                                                                                                                     │ost.wip: nodenam                                                                                                                                                                                                 │ame nor servname provided, or                                                                                                                                                                                                 │
│                                                                                                                                                                                                  │                                                                                                                                                                                                     │e nor servname p                                                                                                                                                                                                 │not known                                                                                                                                                                                                                     │
│                                                                                                                                                                                                  │                                                                                                                                                                                                     │rovided, or not                                                                                                                                                                                                  │                                                                                                                                                                                                                              │
│                                                                                                                                                                                                  │                                                                                                                                                                                                     │known                                                                                                                                                                                                            │                                                                                                                                                                                                                              │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Line ending issue with windows (CRLF)

I have simple request:

### Test request
POST {{host}}/something
Accept: text/plain
Content-Type: application/json

{
  "test": "me"
}

With unix (LF) line ending it executes as expected.

##### POST http://localhost/something #####
--> POST http://localhost/something
Content-Length: 18
Accept: text/plain
Content-Type: application/json

{
  "test": "me"
}
--> END POST (18-byte body)

With Windows (CRLF) line ending it executes with extra line break, and put headers into body:

##### POST http://localhost/something #####
--> POST http://localhost/something
Content-Length: 74

Accept: text/plain
Content-Type: application/json

{
  "test": "me"
}
--> END POST (74-byte body)

Cookies are not persisted between requests

Currently, the cookie jar is not handled by the restcli. There is an option to disable it isNoCookieJar but it's never used.
Is there a plan for handling persistent cookies between requests (cookie jar). This feature is available in IJ.

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.