Django-Next.js Ошибка загрузки изображения с пустым телом

Пользователи в моем приложении могут изменять изображение своего профиля, однако когда я отправляю запрос на внутренний сервер, он возвращает пустое тело.

Frontend

    const handleImageChange = useCallback(async (e) => {
    const confirmation = confirm('Press ok to update profile')
    if (confirmation) {
        const form = new FormData()
        form.append('userProfileImage', e.target.files[0])
        const location = process.env.NEXT_PUBLIC_API_URL + `/user/update/profile`
        const api = await fetch(location,
            {
                method: 'Patch',
                headers: {
                    'Accept': 'application/json',
                    'Content-type': 'multipart/form-data; boundary=---WebKitFormBoundary7MA4YWxkTrZu0gW',

                },
                body: form
            }
        )
    }
}, [])

Код бэкенда

class profileImageUpdateView(UpdateAPIView):
serializer_class = userProfileImageSerializer
http_method_names = ['patch']

def get_object(self):
    user = self.request.user
    instance = userProfile.objects.get(user = user)
    return instance

def patch(self, request, *args, **kwargs):
    print(request.data)
    return super().patch(request, *args, **kwargs)
Вернуться на верх