@minecraft/server-net 1.0.0-beta.00001b50 → 1.0.0-beta.11940b23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +6 -1
  2. package/package.json +2 -2
  3. package/tests.ts +14 -2
package/index.d.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * ```json
17
17
  * {
18
18
  * "module_name": "@minecraft/server-net",
19
- * "version": "1.0.0-beta.00001b50"
19
+ * "version": "1.0.0-beta.11940b23"
20
20
  * }
21
21
  * ```
22
22
  *
@@ -136,6 +136,11 @@ export class HttpRequest {
136
136
  */
137
137
  addHeader(key: string, value: minecraftserveradmin.SecretString | string): HttpRequest;
138
138
  constructor(uri: string);
139
+ /**
140
+ * @remarks
141
+ * Updates the content of the body of the HTTP request.
142
+ * @param body
143
+ */
139
144
  setBody(body: string): HttpRequest;
140
145
  /**
141
146
  * @remarks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-net",
3
- "version": "1.0.0-beta.00001b50",
3
+ "version": "1.0.0-beta.11940b23",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "dependencies": {
16
- "@minecraft/server-admin": "1.0.0-beta.00001b50"
16
+ "@minecraft/server-admin": "1.0.0-beta.11940b23"
17
17
  },
18
18
  "license": "MIT"
19
19
  }
package/tests.ts CHANGED
@@ -1,7 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1
2
  import * as mc from '@minecraft/server';
2
- import * as mcnet from '@minecraft/server-net';
3
3
 
4
- export async function updateScore() {
4
+ export async function updateScore(log: (message: string, status?: number) => void, targetLocation: mc.Location) {
5
5
  const req = new mcnet.HttpRequest('http://localhost:3000/updateScore');
6
6
 
7
7
  req.body = JSON.stringify({
@@ -125,3 +125,15 @@ export default class SampleManager {
125
125
  }
126
126
  }
127
127
  }
128
+
129
+ import * as mcnet from '@minecraft/server-net'; // keep in for net samples
130
+
131
+ const mojangNetAdminTestFuncs: {
132
+ [name: string]: Array<(log: (message: string, status?: number) => void, location: mc.Location) => void>;
133
+ } = {
134
+ updateScore: [updateScore],
135
+ };
136
+
137
+ export function register(sampleManager: SampleManager) {
138
+ sampleManager.registerSamples(mojangNetAdminTestFuncs);
139
+ }