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 htmlEncode/Decode filters #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/accept-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
pr_detail_file="pr_detail.json"
gh api repos/"${OWNER}"/"${REPO}"/pulls/"${PR_NUMBER}" > "${pr_detail_file}"
jq . "${pr_detail_file}"
echo ${{ github.event.issue.title }}
echo "github.event.issue.title: ${{ github.event.issue.title }}"
HEAD_REPO_FULL_NAME=$(jq -rc .head.repo.full_name ${pr_detail_file})
BASE_REPO_FULL_NAME=$(jq -rc .base.repo.full_name ${pr_detail_file})
if [ "${HEAD_REPO_FULL_NAME}" = "${BASE_REPO_FULL_NAME}" ] ; then
Expand Down
62 changes: 57 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,30 @@

Thank you for investing time in our project!

## Issues
## 🐛 Issues

Whether you have discovered a bug, want a new feature in Hurl, or change code, [please fill an issue] before any PR.
We like to discuss things before implementation and want to be sure that:

- Any new features is coherent with Hurl core values
- Any new features are coherent with Hurl core values
- You don't waste time on a feature that will not fit Hurl
- All options have been considered if possible
- We try to minimize dependencies and import new crates parsimoniously

## Pull Requests
## 🥳 Pull Requests

- Commits have to be signed.
- All tests must be green before merge.
- Hurl git history is linear, so we ask to rebase your PR before final merge.

## Hurl Core Values
## ❤️ Hurl Core Values

- Hurl is a first class citizen CLI tool, fast and reliable
- Hurl is a cherry on the top of curl. What you can do with curl, you could do it with Hurl
- Hurl file format is text plain, loosely based on HTTP
- Hurl is multiplatform, working on Linux, macOS, Windows

## How Can You Help ?
## 👀 How Can You Help ?

- Installing / Packet managers: bundle Hurl for a particular packet manager is welcome. Currently, we built binaries for
Linux, macOS, Windows and we support a narrow set of packet manager. [More would be better!]
Expand All @@ -33,10 +34,61 @@ integrated way to run Hurl file would be cool also
- [Documentation] is a never finished work and could be always improve. Don't hesitate to clarify, fix typos etc...
- Report bugs: if possible some simple repro steps with the Hurl version, name of the platform etc...

## 🤯 Build and Test

Hurl is a Rust project, so you will need the Rust toolchain to build it. You can check the [Hurl build documentation] to
see how to build locally the latest version (master branch).

Once your setup is ready, just build the project:

```shell
$ cargo build
Compiling hurl_core v2.0.0-SNAPSHOT (/Users/jc/Documents/Dev/hurl/packages/hurl_core)
...
Compiling hurlfmt v2.0.0-SNAPSHOT (/Users/jc/Documents/Dev/hurl/packages/hurlfmt)
Compiling hurl v2.0.0-SNAPSHOT (/Users/jc/Documents/Dev/hurl/packages/hurl)
Finished dev [unoptimized + debuginfo] target(s) in 2.53s
```

Hurl unit and integration tests need Python 3.6+ to be run. You can use a [virtual environment] and install the dependencies needed
by the tests suite:

```shell
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip3 install --requirement bin/requirements-frozen.txt
```

Then, you can launch our local server (used to test Hurl features):

```shell
$ cd integration
$ python3 server.py >server.log 2>&1 &
$ python3 ssl/server.py >server-ssl.log 2>&1 &
$ mitmdump --listen-host 127.0.0.1 --listen-port 8888 --modify-header "/From-Proxy/Hello" >mitmdump.log 2>&1 &
$ jobs
[1] running python3 server.py > server.log 2>&1
[2] - running python3 ssl/server.py > server-ssl.log 2>&1
[3] + running mitmdump --listen-host 127.0.0.1 --listen-port 8888 --modify-header > 2>&1
```

You can check [`bin/test/test_prerequisites.sh`] and [`bin/test/test_prerequisites.ps1`] for more details.

Now, you can follow these steps when you make changes:

1. Build `cargo build`
2. Run Clippy `cargo clippy`
3. Format `cargo fmt`
4. Run units tests `cargo test`
5. Run integration tests `cd integration && python3 integration.py`

Et voilà 🎉!


[please fill an issue]: https://github.com/Orange-OpenSource/hurl/issues
[More would be better!]: https://github.com/BurntSushi/ripgrep#installation
[Documentation]: https://github.com/BurntSushi/ripgrep#installation
[Hurl build documentation]: https://hurl.dev/docs/installation.html#building-from-sources
[`bin/test/test_prerequisites.sh`]: /bin/test/test_prerequisites.sh
[`bin/test/test_prerequisites.ps1`]: /bin/test/test_prerequisites.ps1
[virtual environment]: https://docs.python.org/3/tutorial/venv.html
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contrib/vim/syntax/hurl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ syntax keyword operator == != > >= < <= not
syntax keyword query status url header cookie body jsonpath xpath regex variable duration sha256 md5 bytes
syntax keyword predicate startsWith endsWith matches exists includes isInteger isFloat isBoolean isString isCollection
syntax match predicate "contains"
syntax keyword filter count regex urlEncode urlDecode
syntax keyword filter count regex urlEncode urlDecode htmlEscape htmlUnescape
syntax match escapeNumberSign "\\#"
syntax match escapeQuote "\\\""
syntax region string start='"' end='"' contains=escapeQuote
Expand Down
5 changes: 4 additions & 1 deletion docs/spec/hurl.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,11 @@ url-encode-filter: "urlEncode"

url-decode-filter: "urlDecode"

to-int: "toInt"
html-encode-filter: "htmlEscape"

html-decode-filter: "htmlUnescape"

to-int: "toInt"

# Lexical Grammar

Expand Down
2 changes: 0 additions & 2 deletions integration/report/html/index.html

This file was deleted.

27 changes: 0 additions & 27 deletions integration/report/html/report.css

This file was deleted.

100 changes: 0 additions & 100 deletions integration/report/html/tests/assert_base64.hurl.html

This file was deleted.

Loading