3

My config for fos_rest section:

fos_rest:
    serializer:
        serialize_null: true
    view:
        view_response_listener: force
        force_redirects:
            html: true
        formats:
            jsonp: true
            json: true
            xml: false
            rss: false
        templating_formats:
            html: false
        mime_types:
            json: ['application/json', 'application/x-json', 'application/vnd.example-com.foo+json']
            jsonp: ['application/jsonp']
            rss: 'application/rss+xml'
            jpg: 'image/jpeg'
            png: 'image/png'
        jsonp_handler:
            callback_param:       callback
    body_listener: true
    param_fetcher_listener: force
    allowed_methods_listener: true
    access_denied_listener:
        json: true
    format_listener:
        rules:
          - { path: '^/', priorities: ['jsonp','json', 'xml'], fallback_format: json, prefer_extension: true }
    routing_loader:
        default_format: ~
    exception:
        codes:
            'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
            'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
        messages:
            'Symfony\Component\Routing\Exception\ResourceNotFoundException': true

When I try to access ie

http://10.0.0.10/users.jsonp?callback=call 

I have data forced to download and not displayed. Requested data is correct. How to make it display in the browser?

hardik
  • 9,141
  • 7
  • 32
  • 48
debianek
  • 589
  • 1
  • 9
  • 30

2 Answers2

0

Change your config to:

fos_rest:
    ...
    view:
        ...
        jsonp_handler:
            callback_param: callback
            # add jsonp mime-type here
            # it's `application/javascript+jsonp` by default
            mime_type: application/javascript
Dos
  • 841
  • 10
  • 23
0

If you're just wanting bug track the payload and you're on a *nix system, you can use curl for that sort of thing. Try something like this:

curl -i -X GET http://10.0.0.10/users.jsonp?callback=call
piers.warmers
  • 333
  • 2
  • 6