Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

WebApiConfig.cs 1.2 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  1. namespace SendAttachmentBot
  2. {
  3. using System.Web.Http;
  4. using Newtonsoft.Json;
  5. using Newtonsoft.Json.Serialization;
  6. public static class WebApiConfig
  7. {
  8. public static void Register(HttpConfiguration config)
  9. {
  10. // Json settings
  11. config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
  12. config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
  13. config.Formatters.JsonFormatter.SerializerSettings.Formatting = Formatting.Indented;
  14. JsonConvert.DefaultSettings = () => new JsonSerializerSettings()
  15. {
  16. ContractResolver = new CamelCasePropertyNamesContractResolver(),
  17. Formatting = Newtonsoft.Json.Formatting.Indented,
  18. NullValueHandling = NullValueHandling.Ignore,
  19. };
  20. // Web API configuration and services
  21. // Web API routes
  22. config.MapHttpAttributeRoutes();
  23. config.Routes.MapHttpRoute(
  24. name: "DefaultApi",
  25. routeTemplate: "api/{controller}/{id}",
  26. defaults: new { id = RouteParameter.Optional });
  27. }
  28. }
  29. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...