feat: add http_client from daw-lua-common #1

Closed
opened 2026-05-13 18:20:26 +02:00 by michael · 1 comment
Owner

Summary

http_client.lua was removed from daw-lua-common as part of the
structure migration (DAW/daw-lua-common#15). It belongs in daw-lua-net
as it has a hard external dependency on luasocket (socket.http + ltn12).

Source

http_client.lua from DAW/daw-lua-common -- last state before removal.

The module internally requires json for encoding/decoding request/response
bodies. This internal require must be updated to require("daw.common.json")
following the external DAW dependency rule (DAW/daw-docs#6).

Interface

local http = require("daw.net.http_client")

local body, status, err = http.get(url, headers)
local body, status, err = http.post(url, body_table, headers)
local body, status, err = http.put(url, body_table, headers)
local body, status, err = http.get_raw(url, headers)

Acceptance Criteria

  • http_client.lua added to daw-lua-net
  • Internal require("daw.lua.common.json") updated to require("daw.common.json")
  • Tests migrated from DAW/daw-lua-common
  • README updated
  • Deprecation shim in daw-lua-common planned (separate issue)

Refs

DAW/daw-lua-common#15
DAW/daw-docs#6

## Summary `http_client.lua` was removed from `daw-lua-common` as part of the structure migration (DAW/daw-lua-common#15). It belongs in `daw-lua-net` as it has a hard external dependency on luasocket (`socket.http` + `ltn12`). ## Source `http_client.lua` from DAW/daw-lua-common -- last state before removal. The module internally requires json for encoding/decoding request/response bodies. This internal require must be updated to `require("daw.common.json")` following the external DAW dependency rule (DAW/daw-docs#6). ## Interface ```lua local http = require("daw.net.http_client") local body, status, err = http.get(url, headers) local body, status, err = http.post(url, body_table, headers) local body, status, err = http.put(url, body_table, headers) local body, status, err = http.get_raw(url, headers) ``` ## Acceptance Criteria - [ ] `http_client.lua` added to daw-lua-net - [ ] Internal `require("daw.lua.common.json")` updated to `require("daw.common.json")` - [ ] Tests migrated from DAW/daw-lua-common - [ ] README updated - [ ] Deprecation shim in daw-lua-common planned (separate issue) ## Refs DAW/daw-lua-common#15 DAW/daw-docs#6
Author
Owner

Done in v1.0.0

  • ip_utils.lua moved to repo root (was src/daw/lua/net/ip_utils.lua)
  • http_client.lua added from DAW/daw-lua-common (DAW/daw-lua-common#15)
  • _NAME + daw_register added to both modules
  • require updated to daw.common.json (was daw.lua.common.json)
  • init.lua added as entry point for daw.net namespace
  • test/dev-module-map.lua added with daw.net.* and daw.common.* entries
  • test/helpers.lua updated to new searcher pattern
  • 20 tests green on Lua 5.1 and 5.4

Refs: DAW/daw-docs#7

## Done in v1.0.0 - ip_utils.lua moved to repo root (was src/daw/lua/net/ip_utils.lua) - http_client.lua added from DAW/daw-lua-common (DAW/daw-lua-common#15) - _NAME + daw_register added to both modules - require updated to daw.common.json (was daw.lua.common.json) - init.lua added as entry point for daw.net namespace - test/dev-module-map.lua added with daw.net.* and daw.common.* entries - test/helpers.lua updated to new searcher pattern - 20 tests green on Lua 5.1 and 5.4 Refs: DAW/daw-docs#7
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-lua-net#1
No description provided.