Error code 404 if SiteDefinitionApiEnabled is false

Found in

EPiServer.ContentDeliveryApi 1.0.1

Fixed in

EPiServer.ContentDeliveryApi 2.1.0

Created

Jun 22, 2018

Updated

Oct 30, 2018

State

Closed, Fixed and tested


Description

Steps to reproduce:

1. Disable SiteDefinitionApiEnabled settings in code:

            var contentApiOptions = new ContentApiOptions
            {
                SiteDefinitionApiEnabled = false
            };

2. Send a GET request:

{{EPCMSHost}}/api/episerver/v1.0/site

Expected:
Returns error code 403 Forbidden.

Actual:
Returns error code 404 Not Found - this causes confusion that there is no site data in the CMS.

    "error": {
        "code": "NotFound",
        "message": "Not Found"
    }