将Symfony从4.3更新到4.4后错误的内容类型

时间:2019-12-16 19:14:51

标签: symfony symfony4 api-platform.com

我已通过composer更新将Symfony项目(api平台)从4.3更新到4.4,但是现在我在POST请求中收到此错误:

  

不支持内容类型“ application / json”。支持的MIME   类型是“”。

断线的踪迹:

  

../ vendor / api-platform / core / src / EventListener / DeserializeListener.php

有什么主意吗?

编辑:

使用命令:

bin/console debug:config api_platform

我有这个api_platform.yaml

    api_platform:
    path_segment_name_generator: api_platform.path_segment_name_generator.dash
    enable_fos_user: true
    eager_loading:
        force_eager: false
        enabled: true
        fetch_partial: false
        max_joins: 30
    oauth:
        enabled: true
        flow: password
        tokenUrl: /api/login
        clientId: ''
        clientSecret: ''
        type: oauth2
        authorizationUrl: /oauth/v2/auth
        scopes: {  }
    mapping:
        paths:
            - /var/www/srv/config/packages/apiplatform/user.yml
            - /var/www/srv/config/packages/apiplatform/business.yml
            - /var/www/srv/config/packages/apiplatform/service.yml
            - /var/www/srv/config/packages/apiplatform/worker.yml
            - /var/www/srv/src/Entity
    title: ''
    description: ''
    version: 0.0.0
    show_webby: true
    default_operation_path_resolver: api_platform.operation_path_resolver.underscore
    name_converter: null
    allow_plain_identifiers: false
    validator:
        serialize_payload_fields: {  }
    enable_nelmio_api_doc: false
    enable_swagger: true
    enable_swagger_ui: true
    enable_re_doc: true
    enable_entrypoint: true
    enable_docs: true
    enable_profiler: true
    collection:
        exists_parameter_name: exists
        order: ASC
        order_parameter_name: order
        pagination:
            enabled: true
            partial: false
            client_enabled: false
            client_items_per_page: false
            client_partial: false
            items_per_page: 30
            maximum_items_per_page: null
            page_parameter_name: page
            enabled_parameter_name: pagination
            items_per_page_parameter_name: itemsPerPage
            partial_parameter_name: partial
    resource_class_directories: {  }
    doctrine:
        enabled: true
    doctrine_mongodb_odm:
        enabled: false
    graphql:
        enabled: false
        default_ide: graphiql
        graphiql:
            enabled: false
        graphql_playground:
            enabled: false
        nesting_separator: _
        collection:
            pagination:
                enabled: true
    swagger:
        versions:
            - 2
            - 3
        api_keys: {  }
    http_cache:
        etag: true
        max_age: null
        shared_max_age: null
        vary:
            - Accept
        public: null
        invalidation:
            enabled: false
            varnish_urls: {  }
            request_options: {  }
    mercure:
        enabled: false
        hub_url: null
    messenger:
        enabled: false
    elasticsearch:
        enabled: false
        hosts: {  }
        mapping: {  }
    exception_to_status:
        Symfony\Component\Serializer\Exception\ExceptionInterface: 400
        ApiPlatform\Core\Exception\InvalidArgumentException: 400
        ApiPlatform\Core\Exception\FilterValidationException: 400
        Doctrine\ORM\OptimisticLockException: 409
    formats:
        jsonld:
            mime_types:
                - application/ld+json
        json:
            mime_types:
                - application/json
        html:
            mime_types:
                - text/html
    patch_formats: {  }
    error_formats:
        jsonproblem:
            mime_types:
                - application/problem+json
        jsonld:
            mime_types:
                - application/ld+json

0 个答案:

没有答案