{"id":13710421,"url":"https://github.com/andreburgaud/meetup-golang-httpexpect","last_synced_at":"2026-01-18T07:42:27.520Z","repository":{"id":83116852,"uuid":"376967907","full_name":"andreburgaud/meetup-golang-httpexpect","owner":"andreburgaud","description":"Go code and examples used during the GoMN meetup on 6/19/2021","archived":false,"fork":false,"pushed_at":"2022-09-26T01:38:48.000Z","size":673,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-13T20:40:49.710Z","etag":null,"topics":["api","go","golang","http","meetup","server","talk","testing","web"],"latest_commit_sha":null,"homepage":"https://www.meetup.com/golangmn/events/278773494/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreburgaud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-14T22:06:54.000Z","updated_at":"2022-09-26T01:38:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"836880de-c1a9-49ec-bf62-43720cf13504","html_url":"https://github.com/andreburgaud/meetup-golang-httpexpect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreburgaud%2Fmeetup-golang-httpexpect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreburgaud%2Fmeetup-golang-httpexpect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreburgaud%2Fmeetup-golang-httpexpect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreburgaud%2Fmeetup-golang-httpexpect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreburgaud","download_url":"https://codeload.github.com/andreburgaud/meetup-golang-httpexpect/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252753230,"owners_count":21798937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","go","golang","http","meetup","server","talk","testing","web"],"created_at":"2024-08-02T23:00:55.912Z","updated_at":"2026-01-18T07:42:27.503Z","avatar_url":"https://github.com/andreburgaud.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"# GoMN Meetup - httpexpect\n\n## Folders Description\n\n* `1_gotesting`: Golang tests (no server involved) of an Add function using table driven data and subtests\n\n* `2_go_web_servers`: Different approaches of serving HTTP requests using the Golang builtin `net/http` package\n  * server1: Define a HTTP Handler and use ServeHTTP\n  * server2: Convert a function to HTTP handler using `http.HandlerFunc`\n  * server3: Convert a function implicitly to `http.HandlerFunc`\n  * server4: Use `http.HandleFunc` to register functions as HTTP handlers\n\n* `3_httptest`: Examples using `net/http/httptest`\n\n* `4_httpexpect`: Examples using `httpexpect`\n  * `add_server`: testing of the Add function served via HTTP\n  * `fastapi`: testing of a FastAPI server using Golang and `httpexpect`\n  * `self_contained`: server and test in the same file\n  * `separate_processes`: test a server started as a separate process\n\n* `slides`: Presentation slides in PDF format\n\n## FastAPI Example\n\nFastAPI is a Python high performance web framework compatible with Python 3.6+\n\nTo execute the FastAPI server in directory `4_httpexpect/fastapi/web` you first need to prepare a Python virtual environment. The instructions below assume that you have Python 3 installed:\n\n```\n$ python3 -m venv .venv\n$ . .venv/bin/activate\n$ pip install fastapi[all] # only once\n$ uvicorn main:app\n```\n\nThe installation of fastapi is done only once. Subsequently, the folloing should be sufficient to activate the environment and start the web server:\n\n```\n$ . .venv/bin/activate\n$ uvicorn main:app\n```\n\nThe `Makefile` included in the same folder shows other options to start the server.\n\nAfter starting the server, you can point your browser to http://localhost:8000/docs to display the Swagger UI.\n\nTo test using `httpexpect`, in the directory `4_httpexpect/fastapi/test`, execute the following command:\n\n```\n$ go test -v\n```\n\nThe test folder is a Go mod project. If you experience any error related to the `httpexpect`, fetch the package manually with the followng command, and execute the test again:\n\n```\n$ go get github.com/gavv/httpexpect/v2\n```\n\n## Resources\n\n* https://github.com/gavv/httpexpect\n* https://www.meetup.com/golangmn/events/278773494/\n* https://tech.spscommerce.com/2021/06/11/andre-burgaud-presents.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreburgaud%2Fmeetup-golang-httpexpect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreburgaud%2Fmeetup-golang-httpexpect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreburgaud%2Fmeetup-golang-httpexpect/lists"}