OData / OData/AspNetCoreOData

Method HEAD is not allowed on $metadata

Open
#385 6 comments 1 reaction 1 assignee View on GitHub

@xuzhg is already working on this.

Since Nov 23, 2021.

investigating
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Hello,

Version Microsoft.AspNetCore.OData, Version=8.0.4.0

Seems default controller doesn't allow HEAD method requests on $metadata requests: http://www.xx.com/api/<CustomerId>$metadata": The remote server returned an error: (405) Method Not Allowed.

/// <summary>
/// Represents a controller for generating OData service and metadata ($metadata) documents.
/// </summary>
public class MetadataController : ControllerBase
{
    private static readonly Version _defaultEdmxVersion = new Version(4, 0);

    /// <summary>
    /// Generates the OData $metadata document.
    /// </summary>
    /// <returns>The <see cref="IEdmModel"/> representing $metadata.</returns>
    [HttpGet]
    public IEdmModel GetMetadata()
    {
        return GetModel();
    }

I use it to make sure my customer's model is online and not to download XML.

Any reason why being so restrictive?

Kind regards

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.