Skip to content

Commit

Permalink
refactor: change authorization header getting logic for recap api
Browse files Browse the repository at this point in the history
  • Loading branch information
gmkim20713 committed Nov 4, 2024
1 parent a392373 commit 0c29ec6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions photo-service/src/main/java/kr/mafoo/photo/api/RecapApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import kr.mafoo.photo.annotation.RequestMemberId;
import kr.mafoo.photo.controller.dto.request.RecapCreateRequest;
import kr.mafoo.photo.controller.dto.response.RecapResponse;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
Expand All @@ -29,8 +30,7 @@ Mono<RecapResponse> createRecap(
@RequestParam(required = false)
String sort,

@RequestHeader("Authorization")
String authorizationToken
ServerHttpRequest serverHttpRequest
);

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import kr.mafoo.photo.controller.dto.response.RecapResponse;
import kr.mafoo.photo.service.RecapService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

Expand All @@ -19,8 +20,10 @@ public Mono<RecapResponse> createRecap(
String memberId,
RecapCreateRequest request,
String sort,
String authorizationToken
ServerHttpRequest serverHttpRequest
) {
String authorizationToken = serverHttpRequest.getHeaders().getFirst("Authorization");

return recapService.createRecap(request.albumId(), memberId, sort, authorizationToken)
.map(RecapResponse::fromString);
}
Expand Down

0 comments on commit 0c29ec6

Please sign in to comment.