Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] supporting json array in request body

See original GitHub issue

When I try to send an array as a request body, I get an exception.

def request_validation(self, request, query, json, headers, cookies):
        req_query = request.args or {}
        if request.mimetype in self.FORM_MIMETYPE:
            req_json = request.form or {}
            if request.files:
                req_json = dict(
                    list(request.form.items()) + list(request.files.items())
            req_json = request.get_json(silent=True) or {}
        req_headers = request.headers or {}
        req_cookies = request.cookies or {}
        request.context = Context(
            query.parse_obj(req_query.items()) if query else None,
>           json.parse_obj(req_json.items()) if json else None,
            headers.parse_obj(req_headers.items()) if headers else None,
            cookies.parse_obj(req_cookies.items()) if cookies else None,
E       AttributeError: 'list' object has no attribute 'items'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

kemingycommented, Feb 18, 2022

I see. I forget JSON body can be a list and pydantic supports __root__.

Will fix this. Thanks.

kemingycommented, May 8, 2022

I think it sounds like a problem #96

This one is related to PyPy support caused bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Volley, JsonObjectRequest but receiving JsonArray
I don't think there will be any problem in creating JsonArrayRequest and sending jsonarray as request body because request body always goes as...
Read more >
Test runner - set array from json data to request body not ...
windupurnomo commented on Apr 13, 2018. I have an issue when using runner and json file contains array. I got error: "Data file ......
Read more >
POST request is failing with error 12905 for a JSON array.
POST request is failing with error 12905 for a JSON array. DEFINE VARIABLE oRequest AS IHttpRequest NO-UNDO. DEFINE VARIABLE oURI AS URI ...
Read more >
JSON request body with Arrays - Integrations
The request body has arrays and therefore used "[" and "]" where applicable. But it throws an error that "Invalid Symbol found(open_bracket)". Created...
Read more >
How To Create A JSON Request With More Than One Array ...
Hi,I am using the postURL functionality. JSON Request body contains more than one array element like shown below,Original JSON Request Body Format To...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found