Skip to content

Commit

Permalink
Oauth API prefix 수정 및 깃허브 소셜 로그인 Http Method 수정 (woowacourse-teams#193)
Browse files Browse the repository at this point in the history
* fix: Oauth API prefix 수정 및 깃허브 소셜 로그인 Http Method 수정

* test: Oauth Api Test prefix 수정
  • Loading branch information
hyena0608 authored and eunbii0213 committed Aug 13, 2023
1 parent feccc7b commit 727bbcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -18,7 +17,7 @@
import static org.springframework.http.HttpStatus.FOUND;

@RequiredArgsConstructor
@RequestMapping("/oauth")
@RequestMapping("/api/v1/oauth")
@RestController
public class OauthController {

Expand All @@ -34,7 +33,7 @@ public ResponseEntity<Void> redirectAuthCode(@PathVariable("oauthType") final Oa
return ResponseEntity.status(FOUND).build();
}

@PostMapping("/login/{oauthType}")
@GetMapping("/login/{oauthType}")
public ResponseEntity<Void> login(@PathVariable final OauthType oauthType,
@RequestParam final String code
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName;
import static org.springframework.restdocs.headers.HeaderDocumentation.responseHeaders;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
import static org.springframework.restdocs.request.RequestDocumentation.pathParameters;
import static org.springframework.restdocs.request.RequestDocumentation.queryParameters;
Expand Down Expand Up @@ -46,7 +45,7 @@ void github_redirect_auth_code() throws Exception {
.thenReturn(githubOauthConfig.redirectUri());

// then
mockMvc.perform(get("/oauth/{oauthType}", "github"))
mockMvc.perform(get("/api/v1/oauth/{oauthType}", "github"))
.andExpect(status().is3xxRedirection())
.andExpect(redirectedUrl(githubOauthConfig.redirectUri()))
.andDo(restDocs.document(
Expand All @@ -65,7 +64,7 @@ void github_login() throws Exception {
.thenReturn("Bearer Jwt");

// then
mockMvc.perform(post("/oauth/login/{oauthType}", "github")
mockMvc.perform(get("/api/v1/oauth/login/{oauthType}", "github")
.queryParam("code", "authcode")
.contentType(APPLICATION_JSON)
.characterEncoding(UTF_8)
Expand Down

0 comments on commit 727bbcd

Please sign in to comment.