Skip to content

Rest API: POST action with JSON data fails with TypeError("'coroutine' object is not an iterator") #272

Description

@louis-nexthop

Calling POST action with JSON data would fail with TypeError("'coroutine' object is not an iterator"):

root@bmc-oob:~# curl -s -X POST \
  -H "Content-Type: application/json" \
  -d "{\"action\":\"power-on\"}" \
  http://localhost:8080/api/sys/server
{"Information": {"reason": "TypeError(\"'coroutine' object is not an iterator\")"}, "Actions": [], "Resources": []}

This is because of the transition from aiohttp 2.3.10 -> aiohttp 3.0.0, where Request.json() no longer returns a generator-based coroutine (v2.3.10 vs v3.0.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions