1
django rest 프레임 워크와 함께 angullar2를 사용하고 있습니다. 나는 각 클라이언트에서 문자열을 게시하는 것을 시도하고있다 :'str'객체는 호출 할 수 없습니다 django angular2
postAuthCode(code: string) {
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
var body ={ "code" : code};
return this.http
.post(this.authCodeUrl, {body},options)
.toPromise()
.then(res => {
console.log("the post response", res);
return res ;
})
.catch(this.handleError);
}
백엔드의 뷰 클래스 : 내가 클라이언트에서 테스트 할 때
class AdwordAuthCode(APIView):
def post(self, request, format=None):
"""
:param request:
:param format:
:return: the credentials from the recieved code
"""
data = request.body('code')
print('data', data)
return Response(data)
내가
를 얻을 수
네, 답변 해 주신 데 대해 감사했습니다. – sila