Skip to content

Behavior should be the same when ?api-version is missing, as when it is incorrect. #61

Closed
@colemickens

Description

@colemickens

Setup:

I have an InfoController that looks like this:

using System;
using System.Security.Cryptography;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Api.ContractsV1;

namespace Api.Controllers {
    [ApiVersion("1.0")]
    [Route("/info")]
    public class InfoController {
        public InfoController(){}

        [HttpGet()]
        public InfoContract Index() {
            return new InfoContract{
                Hostname = Environment.MachineName,
            };
        }
    }
}

Here's observed queries, through nginx:

127.0.0.1 - - [25/Nov/2016:21:08:16 +0000] "GET /info HTTP/1.1" 404 0 "-" "curl/7.51.0"
127.0.0.1 - - [25/Nov/2016:21:09:04 +0000] "GET /info?api-version=1.0 HTTP/1.1" 200 31 "-" "curl/7.51.0"
127.0.0.1 - - [25/Nov/2016:21:09:07 +0000] "GET /info?api-version=2.0 HTTP/1.1" 400 192 "-" "curl/7.51.0"

The behavior for missing api-version query parameter should be the same as if a bad version is specified. I expected the first to result in a 400 as well, rather than 404.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions