Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test case for chapter21 #5

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

letterbeezps
Copy link

Add test case for chapter21

  • 在学习的时候,发现极客时间上粘贴的代码与GitHub上源代码有部分差异,所以直接以test case的形式来测试代码,也方便其他人来调试
if  len(request.Task.Cookie) > 0 {
	req.Header.Set("Cookie", request.Task.Cookie)
}
`
测试的发现如果在生成request时没配置Task,这样会Panic,建议 改成如下
```go
if request.Task != nil && len(request.Task.Cookie) > 0 {
	req.Header.Set("Cookie", request.Task.Cookie)
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant