mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 01:47:59 +03:00 
			
		
		
		
	Add X-CSRFToken HTTP header in swagger-ui example (#6968)
This commit is contained in:
		
							parent
							
								
									25ac7ba450
								
							
						
					
					
						commit
						a9e55334e7
					
				| 
						 | 
					@ -45,7 +45,11 @@ this:
 | 
				
			||||||
          SwaggerUIBundle.presets.apis,
 | 
					          SwaggerUIBundle.presets.apis,
 | 
				
			||||||
          SwaggerUIBundle.SwaggerUIStandalonePreset
 | 
					          SwaggerUIBundle.SwaggerUIStandalonePreset
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        layout: "BaseLayout"
 | 
					        layout: "BaseLayout",
 | 
				
			||||||
 | 
					        requestInterceptor: (request) => {
 | 
				
			||||||
 | 
					          request.headers['X-CSRFToken'] = "{{ csrf_token }}"
 | 
				
			||||||
 | 
					          return request;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    </script>
 | 
					    </script>
 | 
				
			||||||
  </body>
 | 
					  </body>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user