Код: Выделить всё
.authorizeHttpRequests((authz) -> authz.anyRequest().permitAll())
Код: Выделить всё
@RestController
@RequestMapping("contact")
public class LeadController {
@Autowired
private PotentialContactRepo potentialContactRepo;
@PostMapping(consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public void addContact(@RequestBody PotentialContact contact) {
potentialContactRepo.save(contact);
}
@GetMapping
public ResponseEntity getContact() {
return ResponseEntity.ok("Hello");
}
}
Код: Выделить всё
POST /contact HTTP/1.1
User-Agent: PostmanRuntime/7.31.0
Accept: */*
Cache-Control: no-cache
Host: localhost:8080
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 151
name=...&contactInfo=...&location=Wherever&description=This%20is%20the%20description%3B!%40%23%24%23%24%40%24%40%23%24%40%23
HTTP/1.1 403 Forbidden
Set-Cookie: Path=/; HttpOnly
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Type: application/json
Transfer-Encoding: chunked
Date: Mon, 27 Nov 2023 05:10:11 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Подробнее здесь: https://stackoverflow.com/questions/775 ... being-used