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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions