Skip to content

fix(client): update Content-Type in GraphsAPI for adding graphs#714

Merged
imbajin merged 5 commits intoapache:masterfrom
chgjin:patch-1
Apr 19, 2026
Merged

fix(client): update Content-Type in GraphsAPI for adding graphs#714
imbajin merged 5 commits intoapache:masterfrom
chgjin:patch-1

Conversation

@chgjin
Copy link
Copy Markdown
Contributor

@chgjin chgjin commented Feb 24, 2026

fix #713

Fix the error in the Content-Type definition in the create interface of Graphs, and change it to application/json.

修正Graphs 的 create 接口中 Content-Type 定义错误的问题,改为application/json
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Feb 24, 2026
@github-actions github-actions Bot added the client hugegraph-client label Feb 24, 2026
@dosubot dosubot Bot added the bug Something isn't working label Feb 24, 2026
public Map<String, String> create(String name, String cloneGraphName, String configText) {
this.client.checkApiVersion("0.67", "dynamic graph add");
RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_TYPE, "text/plain");
RestHeaders headers = new RestHeaders().add(RestHeaders.CONTENT_TYPE, "application/json");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we need to add a test for it to ensure it won't be broken in the future

@imbajin imbajin changed the title Update GraphsAPI.java fix(client): update Content-Type in GraphsAPI for adding graphs Feb 24, 2026
imbajin added 4 commits April 19, 2026 05:08
- Use RestHeaders.APPLICATION_JSON constant in GraphsAPI.create()
- Bump hugegraph-common version from 1.5.0 to 1.7.0
- Add unit tests (Mockito) to verify Content-Type and clone params
- Re-enable integration tests (server NPE fixed in hugegraph#2900)
- Migrate test config files from .properties to JSON format
- Remove outdated assertEquals on response size (server now returns 4 fields)
- Delete orphaned .properties test config files (replaced by .json)
- Remove unused VersionUtil import in GraphsAPITest
…lization

hugegraph-common 1.7.0 added MAPPER.disable(WRITE_DATES_AS_TIMESTAMPS)
with SimpleDateFormat, so Date values are now serialized as String
("yyyy-MM-dd HH:mm:ss.SSS") instead of Long (epoch millis).

This causes the server's UpdateStrategy.formatError() to report
"Date, String" instead of "Date, Long" when checking INTERSECTION
strategy on non-collection properties.
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 19, 2026
@imbajin imbajin merged commit 3f21357 into apache:master Apr 19, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working client hugegraph-client lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 在包 org.apache.hugegraph.api.graphs 中 create 方法定义了Content-Type 为 text/plain,会导致接口返回415错误。

2 participants