TP-26660-email-id-compulsary-fix | add email-id as compulsary header in all apis
This commit is contained in:
@@ -18,11 +18,11 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ public class ExperimentController {
|
||||
@Timed(value = "litmus.attach.variants", percentiles = {0.95, 0.99})
|
||||
public void attachVariants(@PathVariable("experiment_id") String experimentId,
|
||||
@RequestBody List<VariantDefinition> variantDefinitions,
|
||||
HttpServletRequest httpServletRequest) {
|
||||
String emailId = httpServletRequest.getHeader(Constants.HEADER_EMAIL_ID);
|
||||
@RequestHeader(Constants.HEADER_EMAIL_ID) String emailId) {
|
||||
log.info("update variants request for experimentId: {} by: {}", experimentId, emailId);
|
||||
experimentService.attachVariants(experimentId, variantDefinitions, emailId);
|
||||
}
|
||||
|
||||
@@ -84,9 +84,8 @@ public class ExperimentController {
|
||||
@PutMapping(value = "/update/strategies", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Timed(value = "litmus.update.strategies", percentiles = {0.95, 0.99})
|
||||
public void updateStrategies(@RequestBody LitmusExperimentStrategyUpdate litmusExperimentStrategyUpdate,
|
||||
HttpServletRequest httpServletRequest) {
|
||||
String emailId = httpServletRequest.getHeader(Constants.HEADER_EMAIL_ID);
|
||||
log.info("strategy update request received. experiment_id: {}", litmusExperimentStrategyUpdate.getExperimentId());
|
||||
@RequestHeader(Constants.HEADER_EMAIL_ID) String emailId) {
|
||||
log.info("strategy update request received. experiment_id: {} by: {}", litmusExperimentStrategyUpdate.getExperimentId(), emailId);
|
||||
experimentService.updateStrategies(litmusExperimentStrategyUpdate, emailId);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@@ -91,9 +90,8 @@ public class ExperimentControllerV2 {
|
||||
@Timed(value = "litmus.attach.metric.api", percentiles = {0.95, 0.99})
|
||||
public void attachMetric(@PathVariable("experimentId") String experimentId,
|
||||
@RequestBody AttachMetricToExperimentRequest request,
|
||||
HttpServletRequest httpServletRequest) {
|
||||
log.info("Attach metric request received for experimentId: {}, request: {}", experimentId, request);
|
||||
String emailId = httpServletRequest.getHeader(Constants.HEADER_EMAIL_ID);
|
||||
@RequestHeader(Constants.HEADER_EMAIL_ID) String emailId) {
|
||||
log.info("Attach metric request received for experimentId: {}, request: {} by: {}", experimentId, request, emailId);
|
||||
experimentService.attachMetric(experimentId, request, emailId);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,12 +13,11 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/v2/segments")
|
||||
@RequiredArgsConstructor
|
||||
@@ -28,8 +27,7 @@ public class SegmentControllerV2 {
|
||||
private final SegmentService segmentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createSegment(@ModelAttribute CreateSegmentRequest request, HttpServletRequest httpServletRequest) {
|
||||
String emailId = httpServletRequest.getHeader(Constants.HEADER_EMAIL_ID);
|
||||
public ResponseEntity<?> createSegment(@ModelAttribute CreateSegmentRequest request, @RequestHeader(Constants.HEADER_EMAIL_ID) String emailId) {
|
||||
log.info("create segment request received from : {} , payload: {}", emailId, request);
|
||||
SegmentResponse response = segmentService.createSegment(request, emailId);
|
||||
return ResponseEntity.ok(response);
|
||||
|
||||
Reference in New Issue
Block a user