fix aws.zig tests
This commit is contained in:
		
							parent
							
								
									b2ce163b6f
								
							
						
					
					
						commit
						b126ec25e8
					
				
					 1 changed files with 7 additions and 8 deletions
				
			
		
							
								
								
									
										15
									
								
								src/aws.zig
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								src/aws.zig
									
										
									
									
									
								
							|  | @ -1165,22 +1165,22 @@ fn buildPath( | ||||||
|                 inline for (std.meta.fields(ActionRequest)) |field| { |                 inline for (std.meta.fields(ActionRequest)) |field| { | ||||||
|                     if (std.mem.eql(u8, request.fieldNameFor(field.name), replacement_label)) { |                     if (std.mem.eql(u8, request.fieldNameFor(field.name), replacement_label)) { | ||||||
|                         try replaced_fields.append(allocator, replacement_label); |                         try replaced_fields.append(allocator, replacement_label); | ||||||
|                         var replacement_buffer = try std.ArrayList(u8).initCapacity(allocator, raw_uri.len); |                         var replacement_buffer = try std.Io.Writer.Allocating.initCapacity(allocator, raw_uri.len); | ||||||
|                         defer replacement_buffer.deinit(allocator); |                         defer replacement_buffer.deinit(); | ||||||
| 
 | 
 | ||||||
|                         var encoded_buffer = std.Io.Writer.Allocating.init(allocator); |                         try (&replacement_buffer.writer).print( | ||||||
|                         defer encoded_buffer.deinit(); |  | ||||||
| 
 |  | ||||||
|                         try (&encoded_buffer.writer).print( |  | ||||||
|                             "{f}", |                             "{f}", | ||||||
|                             .{std.json.fmt( |                             .{std.json.fmt( | ||||||
|                                 @field(request, field.name), |                                 @field(request, field.name), | ||||||
|                                 .{ .whitespace = .indent_4 }, |                                 .{ .whitespace = .indent_4 }, | ||||||
|                             )}, |                             )}, | ||||||
|                         ); |                         ); | ||||||
|                         const trimmed_replacement_val = std.mem.trim(u8, replacement_buffer.items, "\""); |                         const trimmed_replacement_val = std.mem.trim(u8, replacement_buffer.written(), "\""); | ||||||
|  | 
 | ||||||
|                         // NOTE: We have to encode here as it is a portion of the rest JSON protocol. |                         // NOTE: We have to encode here as it is a portion of the rest JSON protocol. | ||||||
|                         // This makes the encoding in the standard library wrong |                         // This makes the encoding in the standard library wrong | ||||||
|  |                         var encoded_buffer = try std.Io.Writer.Allocating.initCapacity(allocator, raw_uri.len); | ||||||
|  |                         defer encoded_buffer.deinit(); | ||||||
|                         try uriEncode(trimmed_replacement_val, &encoded_buffer.writer, encode_slash); |                         try uriEncode(trimmed_replacement_val, &encoded_buffer.writer, encode_slash); | ||||||
|                         try buffer.appendSlice(allocator, encoded_buffer.written()); |                         try buffer.appendSlice(allocator, encoded_buffer.written()); | ||||||
|                     } |                     } | ||||||
|  | @ -1442,7 +1442,6 @@ test "REST Json v1 buildpath substitutes" { | ||||||
|     try std.testing.expectEqualStrings("https://myhost/1/", output_path); |     try std.testing.expectEqualStrings("https://myhost/1/", output_path); | ||||||
| } | } | ||||||
| test "REST Json v1 buildpath handles restricted characters" { | test "REST Json v1 buildpath handles restricted characters" { | ||||||
|     if (true) return error.SkipZigTest; |  | ||||||
|     const allocator = std.testing.allocator; |     const allocator = std.testing.allocator; | ||||||
|     var al = std.ArrayList([]const u8){}; |     var al = std.ArrayList([]const u8){}; | ||||||
|     defer al.deinit(allocator); |     defer al.deinit(allocator); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue