Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Conversation

@ehsan-fmb
Copy link

i do what you said.and i give respnse from it.i add golangci-lint .at first it show some errors but i solve them.
then i make test file for that.and again give good response from it.
but i have a problem and hope you to solve it.
the test file print what i expect from it.but at last it give status code 1 that mean to have a error,but i check
http status and it give 200 and print response from server.
i search all of today for that and i can't find anything otherwise i finished it yesterday.

please help 😢

so thankful

@1995parham 1995parham changed the base branch from master to ehsan-fmb May 18, 2019 04:44
Copy link
Contributor

@1995parham 1995parham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have commented on your test file and as an example, you can check here. I those tests I have used the testify library that I have introduced you in my comments.

log.Printf("failed to Unmarshaling:%s",err)
return c.String(http.StatusInternalServerError,"")
}
client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://localhost:27017"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please separate the database connection creation phase from the handler create a stand-alone function for it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants