Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parsing for base64 filters #3628

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

ashishajr
Copy link
Contributor

@ashishajr ashishajr commented Jan 22, 2025

Description

Add parsing for base64Decode and base64Encode filters
Add JSON and HTML formatter support for base64Decode and base64Encode

Related Issue

Add base64Encode/base64Decode filter

@jcamiel
Copy link
Collaborator

jcamiel commented Jan 22, 2025

Ho @ashishajr
When there is new syntax, the CI check that there is 100% code covered when a Hurl file is exported. To make the CI/CD green, you can update the following hurlfmt integration test: integration/hurlfmt/tests_export/filter.hurl. You'll have to update filter.hurl, filter.json (produced with hurlfmt --out json), filter.html (produced with hurlfmt --out html). The filter base64Decoce base64Encode can be non-functionnal as the file is just exported to JSON/HTML and not run.

@jcamiel jcamiel self-requested a review January 22, 2025 11:49
@jcamiel jcamiel assigned jcamiel and ashishajr and unassigned jcamiel Jan 22, 2025
@ashishajr
Copy link
Contributor Author

Ho @ashishajr When there is new syntax, the CI check that there is 100% code covered when a Hurl file is exported. To make the CI/CD green, you can update the following hurlfmt integration test: integration/hurlfmt/tests_export/filter.hurl. You'll have to update filter.hurl, filter.json (produced with hurlfmt --out json), filter.html (produced with hurlfmt --out html). The filter base64Decoce base64Encode can be non-functionnal as the file is just exported to JSON/HTML and not run.

Got it, thanks, I'll update those. I'll have to have to update the filter.lint.hurl file as well right? Is there a way to update it using hurlfmt or hurl or do I have to manually update it?

@jcamiel
Copy link
Collaborator

jcamiel commented Jan 22, 2025

You can just call $ hurlfmt myfile.hurl and the output should be linted

@ashishajr ashishajr force-pushed the base64-filter-parsing branch from 2b88b56 to 86372a9 Compare January 23, 2025 11:04
@ashishajr ashishajr force-pushed the base64-filter-parsing branch from 86372a9 to 7b0c84a Compare January 23, 2025 11:27
@ashishajr
Copy link
Contributor Author

Hey @jcamiel, I'm not quite sure what I'm doing wrong, was hoping you could help me out

I understand that I need to run the integration tests for hurlfmt, following the steps in CONTRIBUTING.MD and integration/README.MD, I did the below

$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install --requirement bin/requirements-frozen.txt
$ cd intrgration/hurlfmt
$ python integration.py # I have setup python as the alias for python3

I run into this error

hurlfmt --out hurl tests_export/body.hurl
hurlfmt --out hurl tests_export/capture.hurl
error: Parsing literal
  --> tests_export/capture.hurl:6:27
   |
 6 | token: jsonpath "$.token" redact
   |                           ^ expecting 'line_terminator'
   |

>>> error in stdout for hurl
actual: <>
expected: <GET http://localhost:8000/dummy

HTTP 200
[Captures]
name: jsonpath "$.name"
token: jsonpath "$.token" redact
>

I gathered that it's probably because it's using the binary installed by hombrew instead of the latest build, so I setup an alias to the binary to test but I still run into the same error

Do I setup hurl and hurlfmt to always point to the binary in ./target/debug/hurl and ./target/debug/hurlfmt respectively or am I missing something?

@jcamiel
Copy link
Collaborator

jcamiel commented Jan 23, 2025

Hi @ashishajr

Yes I need to update the README so it's easier to understand what to do. The current build of hurl should be called when you type hurl in a shell. To do this, you can update your PATH env var, for instance:

$ cd /Users/bob/hurl
$ which hurl
/opt/homebrew/bin/hurl
$ cargo build
$ export PATH=/Users/bob/hurl/target/debug:$PATH
$ which hurl
/Users/bob/hurl/target/debug/hurl

Once you've updated your PATH, you can run the integration test suite and the right hurl binary will be called.

@jcamiel
Copy link
Collaborator

jcamiel commented Jan 23, 2025

/accept

@hurl-bot
Copy link
Collaborator

🕗 /accept is running, please wait for completion.

@hurl-bot
Copy link
Collaborator

✅ Pull request merged with fast forward by jcamiel..

# List of commits merged from ashishajr/hurl/base64-filter-parsing branch into Orange-OpenSource/hurl/master branch:

  • 7b0c84a Update hurlfmt filter export test
  • af53237 Add parsing for base64 filters

@hurl-bot hurl-bot merged commit 7b0c84a into Orange-OpenSource:master Jan 23, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants