[Spec] Server side warnings for NuGet client

Xavier Decoster edited this page Nov 11, 2016 · 3 revisions

Server-side warnings for NuGet client

Problem

The NuGet client issues warnings and errors as they are encountered. For example a warning is shown when running nuget pack and package metadata is invalid. Or an error when nuget push fails to authenticate with a remote server.

Currently, NuGet servers can return errors to the NuGet client using standard HTTP error codes. However adding a warning to responses is not possible.

This spec proposes an approach to add server-side warnings support to all HTTP communications.

Solution

The server can return a NuGet-specific HTTP header, X-NuGet-Warning. When encountered in any HTTP response from a NuGet server, the NuGet client will display a warning message.

Note the X-NuGet-Warning header is not mandatory. When not present, no warning messages should be displayed. The header can occur multiple times. For each value of the header, a warning message must be shown

Here's an example where the API key of the user is about to expire. The server responded with a X-NuGet-Warning header that held the full warning text:

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.