Skip to content

:select with jq prints a newline, by default #43

@bhanuvrat

Description

@bhanuvrat

jq -j would strip the newline it adds.
when I tried to construct a url like

#+NAME: get_user_id
#+BEGIN_SRC http :pretty :var auth_token=login :select .results | .[0] | .id
GET /api/users?search=c
Authorization: Token ${auth_token}
#+END_src

#+RESULTS: get_user_id
: 1bc184b8-b41d-4198-99ae-e69a4ad112a6

GET /api/users/${id}

#+NAME: get_record_of_one_user
#+HEADER: :var auth_token=login 
#+HEADER: :var id=strip(get_user_id)
#+HEADER: :var blah=1
#+BEGIN_SRC http :pretty 
GET http://httpbin.org/anything/${id}
Authorization: Token ${auth_token}

#+END_SRC

the authorization header went to body because id brought a newline along

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions