aequitas / concourse-http-api-resource

Concourse resource to allow interaction with (simple) HTTP API's.
https://hub.docker.com/r/aequitas/http-api-resource/
MIT License
25 stars 18 forks source link

issue #9 #10

Closed masaki-takano closed 6 years ago

masaki-takano commented 6 years ago

use json.dumps(v, ensure_ascii=False)

Sample:

      form_data:
        body: "Hello! Build {BUILD_PIPELINE_NAME} {BUILD_JOB_NAME}, nr: {BUILD_NAME} 日本語? {message}!"

Before result:

"Hello! Build my-template hello, nr: 4 \u65e5\u672c\u8a9e\uff1f \u3067\u304d\u308b\u304b\u306a\uff1f!"

After result:

"Hello! Build my-template hello, nr: 8 日本語? できるかな?!"
aequitas commented 6 years ago

Thanks for contributing. Could you please also add a testcase for this change?

masaki-takano commented 6 years ago

add test

=================================== FAILURES ===================================
____________________________ test_data_ensure_ascii ____________________________
opt/resource-tests/test_invocation.py:127: in test_data_ensure_ascii
    assert output['form'] == {'field': '{"test": "日本語"}'}
E   assert {'field': '{"...72c\\u8a9e"}'} == {'field': '{"test": "日本語"}'}
E     Differing items:
E     {'field': '{"test": "\\u65e5\\u672c\\u8a9e"}'} != {'field': '{"test": "日本語"}'}
E     Use -v to get the full diff
----------------------------- Captured stderr call -----------------------------
aequitas commented 6 years ago

Thank you!