Use proper base url by default instead of hardcoded app_dev controller

This commit is contained in:
Jordi Boggiano 2013-03-01 21:24:54 +01:00
parent b50f3ca185
commit abac2a03df
3 changed files with 6 additions and 2 deletions

View File

@ -38,7 +38,7 @@ class Configuration implements ConfigurationInterface
->addDefaultsIfNotSet()
->children()
->scalarNode('enabled')->defaultTrue()->end()
->scalarNode('endpoint')->defaultValue('/app_dev.php')->end()
->scalarNode('endpoint')->defaultNull()->end()
->arrayNode('request_format')
->addDefaultsIfNotSet()
->children()

View File

@ -13,5 +13,5 @@
<argument type="service" id="nelmio_api_doc.doc_comment_extractor" />
<tag name="nelmio_api_doc.extractor.parser" />
</service>
</services>
</services>
</container>

View File

@ -195,6 +195,10 @@
url += api_key_parameter + '=' + $('#api_key').val();
}
{% if endpoint == '' and app.request is defined and app.request.host -%}
{% set endpoint = app.request.getBaseUrl() -%}
{% endif -%}
// and trigger the API call
$.ajax({
url: '{{ endpoint }}' + url,