From e536121d97610af09d6bf4a51a875b0f7d50f702 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 30 Apr 2021 17:53:40 +0800 Subject: refactor: ... --- BackEnd/Timeline/Routes/Resource.Designer.cs | 72 ++++++++++++ BackEnd/Timeline/Routes/Resource.resx | 123 +++++++++++++++++++++ .../Timeline/Routes/UnknownEndpointMiddleware.cs | 4 +- 3 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 BackEnd/Timeline/Routes/Resource.Designer.cs create mode 100644 BackEnd/Timeline/Routes/Resource.resx (limited to 'BackEnd/Timeline/Routes') diff --git a/BackEnd/Timeline/Routes/Resource.Designer.cs b/BackEnd/Timeline/Routes/Resource.Designer.cs new file mode 100644 index 00000000..1fbbb704 --- /dev/null +++ b/BackEnd/Timeline/Routes/Resource.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Timeline.Routes { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resource { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resource() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Routes.Resource", typeof(Resource).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to The api endpoint you request is unknown. You might get the wrong api entry.. + /// + internal static string MessageUnknownEndpoint { + get { + return ResourceManager.GetString("MessageUnknownEndpoint", resourceCulture); + } + } + } +} diff --git a/BackEnd/Timeline/Routes/Resource.resx b/BackEnd/Timeline/Routes/Resource.resx new file mode 100644 index 00000000..f7e2aec9 --- /dev/null +++ b/BackEnd/Timeline/Routes/Resource.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The api endpoint you request is unknown. You might get the wrong api entry. + + \ No newline at end of file diff --git a/BackEnd/Timeline/Routes/UnknownEndpointMiddleware.cs b/BackEnd/Timeline/Routes/UnknownEndpointMiddleware.cs index 25ec563c..d3f78fd9 100644 --- a/BackEnd/Timeline/Routes/UnknownEndpointMiddleware.cs +++ b/BackEnd/Timeline/Routes/UnknownEndpointMiddleware.cs @@ -24,7 +24,9 @@ namespace Timeline.Routes context.Response.StatusCode = StatusCodes.Status400BadRequest; context.Response.ContentType = MediaTypeNames.Application.Json; - var body = JsonSerializer.SerializeToUtf8Bytes(ErrorResponse.Common.UnknownEndpoint(), new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }); + var body = JsonSerializer.SerializeToUtf8Bytes( + new CommonResponse(ErrorCodes.Common.UnknownEndpoint, Resource.MessageUnknownEndpoint), + new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }); context.Response.ContentLength = body.Length; await context.Response.Body.WriteAsync(body); -- cgit v1.2.3