netbox-secretstore icon indicating copy to clipboard operation
netbox-secretstore copied to clipboard

Fixes: #91 Force using FormParser for GetSessionKeyViewSet

Open mikat-gh opened this issue 3 years ago • 1 comments

Netbox started enforcing application/json for API request in https://github.com/netbox-community/netbox/commit/bfbf97aec9119539f7f42cf16f52d0ca8203ba60

Which broke get-session-key. Override this.

mikat-gh avatar Sep 27 '22 10:09 mikat-gh

FAIL: test_get_session_key (netbox_secretstore.tests.test_api.GetSessionKeyTest)
...
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             err = {                                                      │ │
│ │                   │   'detail': 'Unsupported media type                  │ │
│ │                   "multipart/form-data; boundary=BoUnDaRyStRiNg;         │ │
│ │                   charset=ut'+16                                         │ │
│ │                   }                                                      │ │
│ │     err_message = "Expected HTTP status 200; received 415: {'detail':    │ │
│ │                   ErrorDetail(string='Unsupport"+121                     │ │
│ │ expected_status = 200                                                    │ │
│ │        response = <Response status_code=415, "application/json">         │ │
│ │            self = <netbox_secretstore.tests.test_api.GetSessionKeyTest   │ │
│ │                   testMethod=test_get_session_key>                       │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │

If multipart/form-data should also be supported then MultiPartParser needs to be added also.

mikat-gh avatar Oct 19 '22 06:10 mikat-gh