Skip to content

Unhanded exception is wsgiref (py3) caused from CreateModelMixin #5541

@canni

Description

@canni

Checklist

  • I have verified that that issue exists against the master branch of Django REST framework.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • This is not a usage question. (Those should be directed to the discussion group instead.)
  • This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • I have reduced the issue to the simplest possible case.
  • I have included a failing test

Steps to reproduce

  • python3.x (reporduceable on 3.4 - 3.6)
  • Install django 2.0beta & latest DRF
  • Create simple model
  • Create simple HyperlinkedModelSerializer that uses 'url' field instead of 'id'
  • Create simple viewset
  • run standard django runserver (wsgiref)
  • POST new model

Expected behavior

  • model gets created without any issues

Actual behavior

The issue is that header is of type Hyperlink, and wsgiref explicitly checks for str only
It's caused here: https://github.com/encode/django-rest-framework/blob/master/rest_framework/mixins.py#L30
The data is not a str

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions