Class CurlRequestSnippet

java.lang.Object
org.springframework.restdocs.snippet.TemplatedSnippet
org.springframework.restdocs.cli.CurlRequestSnippet
All Implemented Interfaces:
Snippet

public class CurlRequestSnippet extends TemplatedSnippet
A Snippet that documents the curl command for a request.
Since:
1.1.0
Author:
Andy Wilkinson, Paul-Christian Volkmer, Tomasz Kopczynski
See Also:
  • Constructor Details

    • CurlRequestSnippet

      protected CurlRequestSnippet(CommandFormatter commandFormatter)
      Creates a new CurlRequestSnippet that will use the given commandFormatter to format the curl command.
      Parameters:
      commandFormatter - the formatter
    • CurlRequestSnippet

      protected CurlRequestSnippet(Map<String,Object> attributes, CommandFormatter commandFormatter)
      Creates a new CurlRequestSnippet with the given additional attributes that will be included in the model during template rendering. The given commandFormaatter will be used to format the curl command.
      Parameters:
      attributes - the additional attributes
      commandFormatter - the formatter for generating the snippet
  • Method Details

    • createModel

      protected Map<String,Object> createModel(Operation operation)
      Description copied from class: TemplatedSnippet
      Create the model that should be used during template rendering to document the given operation. Any additional attributes that were supplied when this TemplatedSnippet were created will be automatically added to the model prior to rendering.
      Specified by:
      createModel in class TemplatedSnippet
      Parameters:
      operation - the operation
      Returns:
      the model