Class HeaderDescriptor

java.lang.Object
org.springframework.restdocs.snippet.AbstractDescriptor<HeaderDescriptor>
org.springframework.restdocs.headers.HeaderDescriptor

public class HeaderDescriptor extends AbstractDescriptor<HeaderDescriptor>
A description of a header found in a request or response.
Author:
Andreas Evers
See Also:
  • Constructor Details

    • HeaderDescriptor

      protected HeaderDescriptor(String name)
      Creates a new HeaderDescriptor describing the header with the given name.
      Parameters:
      name - the name
      See Also:
      • HttpHeaders
  • Method Details

    • optional

      public final HeaderDescriptor optional()
      Marks the header as optional.
      Returns:
      this
    • getName

      public final String getName()
      Returns the name for the header.
      Returns:
      the header name
    • isOptional

      public final boolean isOptional()
      Returns true if the described header is optional, otherwise false.
      Returns:
      true if the described header is optional, otherwise false