Guest User

Untitled

a guest
Dec 14th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. using Swashbuckle.AspNetCore.Swagger;
  2. using Swashbuckle.AspNetCore.SwaggerGen;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Threading.Tasks;
  7.  
  8. namespace XP.Rede.FixedIncome.Api.Filters
  9. {
  10. public class AddRequiredHeaderParameter : IOperationFilter
  11. {
  12. public void Apply(Operation operation, OperationFilterContext context)
  13. {
  14. if (operation.Parameters == null)
  15. operation.Parameters = new List<IParameter>();
  16.  
  17. operation.Parameters.Add(new HeaderParameter()
  18. {
  19. Name = "User-Token",
  20. In = "header",
  21. Type = "string",
  22. Required = false
  23. });
  24. }
  25.  
  26. class HeaderParameter : NonBodyParameter
  27. {
  28. }
  29. }
  30. }
Add Comment
Please, Sign In to add comment