-
As title, I am developing the dragonflyoss/client#496, I use opendal to access oss/s3, now I need to add unitests for it. How could I design the unitest, it seems that opendal will only use the 80/443 port, and if i bind mock server with 80 port, it returns 501/502, but when I use reqwest, the server works fine. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hi, please try set
|
Beta Was this translation helpful? Give feedback.
Hi, this approach doesn't work.
127.0.0.1
itself is an IP address, we can't split it in this way. So we can't usevirtual host style
with an IP address; it must be a hostname. Neither<bucket>.127.0.0.1
nor0.0.1
are valid URLs.To mock the OSS service, we need to modify
/etc/hosts
or use reqwest::ClientBuilder::resolve_to_addrs in the HTTP client to map domains<bucket>.<hostname>
to127.0.0.1
.After those setup, we can set oss config
endpoint
tohttp://<hostname>:port
. OpenDAL will send requests tohttp://<bucket>.<hostname>:port
.I…